Update main.py

This commit is contained in:
Paillat
2023-02-06 10:40:33 +01:00
parent 880bdd10a1
commit 4b3b79dc21

20
main.py
View File

@@ -38,14 +38,30 @@ async def get_ln(ctx: discord.AutocompleteContext):
"""Returns a list of colors that begin with the characters entered so far.""" """Returns a list of colors that begin with the characters entered so far."""
return [color for color in languages if color.startswith(ctx.value.lower())] return [color for color in languages if color.startswith(ctx.value.lower())]
@bot.slash_command(name="private_present", description="Generate a presentation with marp, private command for user 707196665668436019")
#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)
@option(name="style", description="The style of the presentation", required=False, autocomplete=get_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)
#command wprks only in dm and only for user 707196665668436019
@commands.is_owner()
async def private_present(ctx: discord.ApplicationContext, subject: str, style: str = "default", language: str = "english", indications: str = ""):
await ctx.defer()
await present(ctx, subject, style, language, indications)
@bot.slash_command(name="present", description="Generate a presentation with marp") @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 #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) @option(name="subject", description="The subject of the presentation", required=True)
@option(name="style", description="The style of the presentation", required=False, autocomplete=get_style) @option(name="style", description="The style of the presentation", required=False, autocomplete=get_style)
@option(name="language", description="The language of the presentation", required=False, autocomplete=get_ln) @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) @option(name="indications", description="The indications for the presentation", required=False)
# a cooldown of duration cooldown seconds # 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.user)
async def present(ctx: discord.ApplicationContext, subject: str, style: str = "default", language: str = "english", indications: str = ""): async def present(ctx: discord.ApplicationContext, subject: str, style: str = "default", language: str = "english", indications: str = ""):
await ctx.defer() await ctx.defer()
date = datetime.datetime.now() date = datetime.datetime.now()