#A question about commands.SubCommand.body

1 messages · Page 1 of 1 (latest)

dire shadow
acoustic zephyrBOT
#

disnake/ext/commands/slash_core.py lines 337 to 339

@property
def body(self) -> Option:
    return self.option
ionic cloak
#

it does make sense. as far as the discord api is concerned, a slash subcommand is an option on its parent

dire shadow
#

Here is the description of the property body of class commands.InvokableApplicationCommand (its parent)

ionic cloak
#

yep

dire shadow
#

oh i see

woven lark
#

This was fun working out for one of my projects. It's not difficult, though.
Just have to iterate and find the disnake.Option.type that is disnake.OptionType.sub_command

dire shadow
#

it's a bit confusing tho since there is no description about it on disnake API reference 😅

ionic cloak
#

yeah, a decent amount of stuff on slash command objects (regrettably) isn't documented as it's mostly meant for internal use

#

honestly kinda surprised it is documented on InvokableSlashCommand

woven lark
#

Honestly, my favorite feature of the docs is that most everything has a direct link to the source. It comes in handy so damn often.

dire shadow
#

i use it in my project but there appears a bug when I use that on SubCommand icant