#Best way to do optional slash options?

1 messages · Page 1 of 1 (latest)

static ledge
#

I want to make it so, if you don’t provide a discord member in the option, it’ll default themselves and if you do, it’ll default to the user they pick..havent found any docs for this

limpid sleetBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

noble spindle
#
  @slash_command(
        name="avatar",
        description="Shows your avatar or a user",
        options=[
            SlashCommandOption(
                name="user",
                description="User to view the avatar.",
                type=OptionType.USER,
                required=False,
            )
        ],
    )
    async def avatar(self, ctx: SlashContext, user: Member = None):
        _user: User = ctx.author.user if user is None else user
#

Something like this will do