#How to provide a description to options?

1 messages · Page 1 of 1 (latest)

dusky tinsel
#

Hey There!
I was working on an image generator command,

async def gen(ctx: commands.Context, *, prompt:str):
    await ctx.defer()
    ETA = int(time.time() + 60)
    msg = await ctx.respond(f" ETA of your image is <t:{ETA}:R>")
    generator = Craiyon()
    result = generator.generate(prompt)
    images = result.images
    for i in images:
        image = BytesIO(base64.decodebytes(i.encode("utf-8")))
        return await msg.edit(content= "`Content generated by craiyon.com`", file=discord.File(image, "image.png"))```
I'm a bit new to pycord and to ask how do we give a description to options such as the prompt str opt.
barren canopy
#
from discord import Option

@bot.slash_command(name= "generate", description ="AI Image Generator")
async def gen(ctx: discord.ApplicationContext, prompt: Option(str, "The prompt to use to generate an image")) -> None:
    ...
#

that is probably what u need

lusty locust
atomic jackal
#

It's the same thing

lusty locust
#

but if ya want to switch to bridge cmds, its helpful in the future

atomic jackal
#

They never said they wanted to switch to bridge commands

gleaming sierra
#

@option is also better as you get better typehinting like str int etc in your editor

#

Bruh didn't mean to mention that guy

still badge
#

@final hilltion

#

there we go

#

bruh