option
Function
Decorator: adds an option to the command. Writing order is kept.
from discord_interactions import optionSignature
def option(opt: OptionBase) -> Callable[[~T], ~T]Parameters
| Name | Type | Default | Description |
|---|---|---|---|
opt | OptionBase | required |
Returns
Callable[[~T], ~T]
Example
from discord_interactions.slash import Integer, String, option @slash.command(description="Répéter")@option(String("texte", "Texte", max_length=200))@option(Integer("fois", "Répétitions", required=False, default=1, min_value=1, max_value=5))async def repeter(ctx, texte, fois): await ctx.respond("\n".join([texte] * fois))