I'm using discord-ext-slash for the first time to create a Discord bot with slash commands (I have used regular Discord.py before, and am pretty experienced at Python in general). I didn't like how you need to create a variable outside of the slash command for each option, so I created a function for it. However, the second argument (required) was not registering, and options would be required even if I set required to false. Here is my code:
def command(desc, required):
return slash.Option(
description=desc,
required=required)
@bot.slash_cmd()
async def repeat(
ctx: slash.Context,
message: command("message to send",True),
):
"""Repeat the given message"""
await ctx.respond(message)