From a749b748261328336ccde21e8c891b44fe67d555 Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 2 Mar 2023 23:26:27 +0100 Subject: [PATCH] Update main.py --- main.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index d2730e4..8b95b2c 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,4 @@ import openai -# from openai import api_key import discord from discord import Intents from discord.commands import slash_command, option @@ -20,7 +19,7 @@ cooldown = os.getenv("COOLDOWN") if use_images != "No": import imagesGeneration logging.basicConfig(level=logging.INFO) imageint = "" -if use_images != "No": imageint = "To add an image illustration , use ![bg left:50% 70%](a-long-detailed-description-of-the-image.png) at the beginning of the slide, just after \"---\". Use only .png. It's not possible to add technical images but only illustrations. The images are generated by an ai, the name of the file should be a detailed quite long description of the image wanted. For example \" ![bg left:50% 100%](a-man-wearing-a hat-ryding-a-bicicle.png)\" but don't need to show a person necessairly." +if use_images != "No": imageint = "To add an image illustration , use ![bg left:50% 70%](a-long-detailed-description-of-the-image.png) at the beginning of the slide, just after \"---\". Use only .png. It's not possible to add technical images but only illustrations. The images are generated by an ai, the name of the file should be a detailed quite long description of the image wanted. You always need to specify the description of the image." intstructions = f'''Here is a presentation with marp. It's not possible to make slides longer than 200 characters. to separate slides, " @@ -51,9 +50,6 @@ async def get_ln(ctx: discord.AutocompleteContext): async def private_present(ctx: discord.ApplicationContext, subject: str, style: str = "default", center: bool = True, language: str = "english", indications: str = ""): await present(ctx, subject, style, language, indications) - - - @bot.slash_command(name="present", description="Generate a presentation with marp") #we create a function that takes the subject of the presentation and the style of the presentation as arguments, and that @option(name="subject", description="The subject of the presentation", required=True) @@ -62,13 +58,10 @@ async def private_present(ctx: discord.ApplicationContext, subject: str, style: @option(name="language", description="The language of the presentation", required=False, autocomplete=get_ln) @option(name="indications", description="The indications for the presentation", required=False) # a cooldown of duration cooldown seconds, except if the user is 707196665668436019 - #@commands.cooldown(1, int(cooldown), commands.BucketType.user) @commands.cooldown(1, int(cooldown), commands.BucketType.guild) async def normal_present(ctx: discord.ApplicationContext, subject: str, style: str = "default", center: bool = True, language: str = "english", indications: str = ""): await present(ctx, subject, style, language, indications) - - async def present(ctx: discord.ApplicationContext, subject: str, style: str = "default", center: bool = True, language: str = "english", indications: str = ""): await ctx.defer() date = datetime.datetime.now() @@ -210,7 +203,7 @@ async def get(ctx: discord.ApplicationContext, pid: str): if pid in liste: files = [discord.File(f"./data/{uid}/{pid}/{liste[pid]}.pdf"), discord.File(f"./data/{uid}/{pid}/{liste[pid]}.md"), discord.File(f"./data/{uid}/{pid}/{liste[pid]}.html")] await ctx.respond(files=files, ephemeral=True) -#when the bot is ready we print a message + @bot.event async def on_ready(): print("Bot is ready")