discord-interactions.py

option

Function

Decorator: adds an option to the command. Writing order is kept.

from discord_interactions import option

Signature

def option(opt: OptionBase) -> Callable[[~T], ~T]

Parameters

NameTypeDefaultDescription
optOptionBaserequired

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))

Type a name: create_button, ModalBuilder, cooldown.