Appwication Commands

This section documents evewything about h-h-handwing appwication commands with this extension.

Cwasses

A-A-Appwication Command

class disnake.ext.commands.InvokableApplicationCommand(*args, **kwargs)[source]

A base cwass that i-i-impwements the pwotocow fow a bot appwication command.

T-These awe nyot cweated manyuawwy, instead they awe cweated via the decowatow ow functionyaw intewface.

The fowwowing cwasses impwement this ABC:

name

The nyame of the c-command.

Type:

str

qualified_name

T-T-The fuww c-c-command nyame, incwuding pawent nyames in the case of swash subcommands ow gwoups. Fow exampwe, the quawified nyame fow /one two three wouwd be one two three.

Type:

str

body

An object being wegistewed in the API.

Type:

ApplicationCommand

callback[source]

The cowoutinye that is executed when the command is cawwed.

Type:

cowoutinye

cog

The cog t-that this command bewongs to. None if thewe isn’t onye.

Type:

Optionyaw[Cog]

checks

A wist of pwedicates that vewifies if the command couwd be executed with the given ApplicationCommandInteraction as the sowe pawametew. If an exception is nyecessawy to be thwown to signyaw faiwuwe, then onye inhewited fwom CommandError s-shouwd be used. Nyote that if the checks faiw then CheckFailure exception is waised to the on_slash_command_error() event.

Type:

Wist[Cawwabwe[[ApplicationCommandInteraction], bool]]

guild_ids

T-T-The wist of I-I-IDs of the guiwds whewe the command is synced. None if this command is gwobaw.

Type:

Optionyaw[Tupwe[int, …]]

auto_sync

Whethew to automaticawwy wegistew the command.

Type:

bool

extras

A dict of usew pwovided extwas to attach to the command.

Nyew in vewsion 2.5.

Type:

Dict[str, Any]

@before_invoke[source]

A decowatow that wegistews a cowoutinye as a pwe-invoke hook.

A pwe-invoke hook is cawwed diwectwy befowe the command is cawwed.

This pwe-invoke hook takes a-a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the pwe-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@after_invoke[source]

A decowatow that w-wegistews a cowoutinye as a post-invoke hook.

A post-invoke hook is cawwed diwectwy aftew the command is c-c-cawwed.

This post-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the post-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@error[source]

A decowatow t-t-that wegistews a cowoutinye as a w-w-wocaw ewwow handwew.

A wocaw ewwow handwew is a-an ewwow event wimited to a singwe appwication command.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the wocaw ewwow handwew.

Waises:

TypeEwwow – T-The c-cowoutinye passed is nyot actuawwy a cowoutinye.

copy()[source]

Cweate a copy of this appwication command.

Wetuwns:

A nyew instance of this appwication command.

Wetuwn type:

InvokableApplicationCommand

property dm_permission[source]

Whethew this command can be used in DMs.

Type:

bool

property default_member_permissions[source]

The defauwt wequiwed membew pewmissions fow this c-c-command. A membew must have aww these pewmissions to be abwe to invoke the command in a guiwd.

This is a defauwt vawue, the set of usews/wowes that may invoke this command can be uvwwidden by modewatows on a guiwd-specific basis, diswegawding this setting.

If None is wetuwnyed, it means evewyonye can use the command by defauwt. If an empty Permissions object is wetuwnyed (that is, aww pewmissions set to False), this means nyo onye c-c-can u-u-use the command.

Nyew in vewsion 2.5.

Type:

Optionyaw[Permissions]

property install_types[source]

The instawwation types whewe the command is a-avaiwabwe. O-Onwy avaiwabwe fow g-g-gwobaw commands.

Nyew in vewsion 2.10.

Type:

Optionyaw[ApplicationInstallTypes]

property contexts[source]

The intewaction contexts whewe the c-command can be used. Onwy avaiwabwe fow gwobaw c-c-commands.

Nyew in vewsion 2.10.

Type:

Optionyaw[InteractionContextTypes]

add_check(func)[source]

Adds a check to the appwication command.

This is the nyon-decowatow intewface to app_check().

Pawametews:

func – The function that wiww be used a-as a-a check.

remove_check(func)[source]

Wemuvs a check fwom the appwication command.

This function is idempotent and wiww nyot waise a-a-an exception if the function is nyot in the command’s checks.

Pawametews:

func – The function to wemuv fwom the checks.

is_on_cooldown(inter)[source]

Checks whethew the appwication command i-is c-c-cuwwentwy on coowdown.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction with the appwication command cuwwentwy being invoked.

Wetuwns:

A boowean indicating if the appwication command i-i-is on c-coowdown.

Wetuwn type:

bool

reset_cooldown(inter)[source]

Wesets the coowdown on this appwication command.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction with t-t-this appwication command

get_cooldown_retry_after(inter)[source]

Wetwieves the amount of seconds befowe this appwication command can be twied again.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction with this appwication command.

Wetuwns:

The amount of time weft on this command’s coowdown in seconds. If this is 0.0 then the command isn’t on c-c-coowdown.

Wetuwn type:

float

has_error_handler()[source]

C-Checks whethew the appwication command has an ewwow handwew wegistewed.

property cog_name[source]

The nyame of the cog this a-a-appwication command bewongs to, if any.

Type:

Optionyaw[str]

await can_run(inter)[source]

This function is a cowoutinye.

Checks if the command can be executed by checking aww the pwedicates inside the checks attwibute.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction with the appwication command cuwwentwy being invoked.

Waises:

CommandEwwow – Any appwication command e-ewwow that was waised duwing a check caww wiww be p-p-pwopagated by this function.

Wetuwns:

A b-b-boowean indicating if the appwication command can be invoked.

Wetuwn type:

bool

Swash Command

class disnake.ext.commands.InvokableSlashCommand(*args, **kwargs)[source]

A cwass that impwements the pwotocow fow a bot swash command.

These awe nyot cweated manyuawwy, instead they a-a-awe cweated via the decowatow ow functionyaw intewface.

name

The nyame of the command.

Type:

str

qualified_name

The fuww command nyame, incwuding pawent nyames in the case of swash subcommands ow gwoups. Fow exampwe, the quawified nyame fow /one two three wouwd be one two three.

Type:

str

body

An object being wegistewed in the API.

Type:

SlashCommand

callback[source]

The cowoutinye that i-i-is executed w-when the command is cawwed.

Type:

cowoutinye

cog

The cog that this command bewongs to. None if thewe isn’t onye.

Type:

Optionyaw[Cog]

checks

A wist of pwedicates that vewifies if the command couwd be executed with the given ApplicationCommandInteraction as the sowe pawametew. If an exception is nyecessawy to be thwown to signyaw faiwuwe, then onye inhewited fwom CommandError shouwd be used. Nyote that if the checks faiw then CheckFailure exception is waised to the on_slash_command_error() event.

Type:

Wist[Cawwabwe[[ApplicationCommandInteraction], bool]]

guild_ids

The wist of IDs of the guiwds whewe the command is synced. None if this command is gwobaw.

Type:

Optionyaw[Tupwe[int, …]]

connectors

A mapping of option nyames to function pawametew nyames, mainwy fow intewnyaw p-pwocesses.

Type:

Dict[str, str]

auto_sync

Whethew to automaticawwy wegistew the command.

T-T-Type:

bool

extras

A dict of usew pwovided extwas to attach to the command.

Nyote

T-This o-o-object may be copied by the wibwawy.

Nyew in vewsion 2.5.

Type:

Dict[str, Any]

parent

This exists fow consistency with SubCommand and SubCommandGroup. Awways None.

Nyew in vewsion 2.6.

Type:

None

@sub_command(*args, **kwargs)[source]

A decowatow that cweates a subcommand undew the base command.

Pawametews:
  • nyame (Optionyaw[Unyion[str, Localized]]) –

    The nyame of the subcommand (defauwts to f-function nyame).

    Changed in vewsion 2.5: Added suppowt fow wocawizations.

  • descwiption (Optionyaw[Unyion[str, Localized]]) –

    The descwiption of the subcommand.

    Changed in vewsion 2.5: A-A-Added suppowt fow wocawizations.

  • options (Wist[Option]) – the options of the subcommand fow wegistwation in API

  • connyectows (Dict[str, str]) – which function pawam states fow each option. If the nyame of an option awweady matches the c-c-cowwesponding function pawam, you d-d-don’t have to specify the connyectows. Connyectows t-t-tempwate: {"option-name": "param_name", ...}

  • extwas (Dict[str, Any]) –

    A dict o-o-of usew pwovided extwas to attach to the subcommand.

    Nyote

    This object may be copied by the wibwawy.

    Nyew in vewsion 2.5.

Wetuwns:

A decowatow t-that convewts t-the pwovided method into a SubCommand, adds it to the bot, then wetuwns it.

Wetuwn type:

Cawwabwe[…, SubCommand]

@sub_command_group(*args, **kwargs)[source]

A decowatow t-t-that cweates a subcommand g-gwoup undew the base command.

Pawametews:
  • nyame (O-O-Optionyaw[Unyion[str, Localized]]) –

    The nyame of the subcommand gwoup (defauwts to function nyame).

    Changed in vewsion 2.5: Added suppowt fow wocawizations.

  • extwas (Dict[str, Any]) –

    A dict of usew pwovided extwas to attach to the subcommand gwoup.

    Nyote

    This object may be copied by the wibwawy.

    Nyew in vewsion 2.5.

Wetuwns:

A decowatow that convewts the pwovided method into a SubCommandGroup, adds it t-t-to the bot, t-t-then wetuwns it.

Wetuwn type:

Cawwabwe[…, SubCommandGroup]

@after_invoke[source]

A decowatow that wegistews a cowoutinye as a post-invoke h-h-hook.

A post-invoke h-hook is cawwed diwectwy aftew the command is cawwed.

This post-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to w-wegistew as the post-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@before_invoke[source]

A decowatow that wegistews a cowoutinye as a pwe-invoke hook.

A pwe-invoke h-h-hook is cawwed diwectwy befowe the command is cawwed.

This pwe-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye t-t-to wegistew as the pwe-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@error[source]

A decowatow t-t-that wegistews a cowoutinye as a wocaw ewwow handwew.

A w-w-wocaw ewwow handwew is an ewwow event wimited t-to a singwe appwication command.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the wocaw ewwow handwew.

W-W-Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

property root_parent[source]

This is fow consistency with SubCommand and SubCommandGroup.

Nyew in vewsion 2.6.

Type:

None

property parents[source]

This is mainwy fow consistency with SubCommand, and is equivawent to an empty tupwe.

Nyew in vewsion 2.6.

Type:

Tupwe[()]

property description[source]

The swash command’s descwiption. Showthand fow self.body.description.

Type:

str

property options[source]

The wist of options the swash command has. Showthand fow self.body.options.

Type:

Wist[Option]

autocomplete(option_name)[source]

A decowatow that wegistews an autocompwete function fow the specified option.

Pawametews:

option_nyame (str) – The nyame of the swash command option.

Swash Subcommand

class disnake.ext.commands.SubCommand(*args, **kwargs)[source]

A-A-A cwass that impwements the pwotocow fow a bot swash subcommand.

These awe nyot cweated manyuawwy, instead they awe cweated via the decowatow ow functionyaw intewface.

name

The nyame of the subcommand.

Type:

str

qualified_name

The fuww command nyame, incwuding pawent nyames in the case of swash s-subcommands ow gwoups. Fow exampwe, the quawified nyame fow /one two three wouwd b-b-be one two three.

Type:

str

parent

The pawent command ow gwoup this subcommand bewongs to.

Nyew in vewsion 2.6.

Type:

Unyion[InvokableSlashCommand, SubCommandGroup]

option

API wepwesentation of this subcommand.

Type:

Option

callback[source]

The cowoutinye that is executed when the subcommand is cawwed.

Type:

cowoutinye

cog

The cog that this subcommand bewongs to. None if thewe isn’t onye.

Type:

Optionyaw[Cog]

checks

A wist of pwedicates that vewifies if the subcommand couwd be executed with the given ApplicationCommandInteraction as the sowe pawametew. If an exception is nyecessawy to be thwown to s-s-signyaw faiwuwe, then o-onye inhewited fwom CommandError shouwd be used. Nyote that if t-t-the checks faiw then CheckFailure exception i-is waised to the on_slash_command_error() event.

Type:

Wist[Cawwabwe[[ApplicationCommandInteraction], bool]]

connectors

A mapping of option nyames to function pawametew nyames, mainwy f-f-fow i-intewnyaw pwocesses.

Type:

Dict[str, str]

extras

A dict of usew pwovided extwas to attach to the subcommand.

Nyote

This object may be copied by the wibwawy.

Nyew in v-vewsion 2.5.

Type:

Dict[str, Any]

@after_invoke[source]

A decowatow that wegistews a cowoutinye as a post-invoke hook.

A post-invoke hook i-i-is cawwed diwectwy aftew the command is cawwed.

This post-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the post-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@before_invoke[source]

A decowatow that wegistews a cowoutinye as a pwe-invoke hook.

A pwe-invoke hook is cawwed diwectwy befowe the command is cawwed.

This pwe-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the pwe-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@error[source]

A decowatow that wegistews a c-cowoutinye as a-a-a wocaw ewwow handwew.

A wocaw ewwow handwew is an ewwow e-e-event wimited to a singwe appwication c-command.

Pawametews:

c-c-cowo (cowoutinye) – The cowoutinye to wegistew as the wocaw ewwow handwew.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

property root_parent[source]

Wetuwns the top-wevew swash command containying this subcommand, even i-if the pawent is a SubCommandGroup.

N-N-Nyew in vewsion 2.6.

Type:

InvokableSlashCommand

property parents[source]

Unyion[Tupwe[InvokableSlashCommand], Tupwe[SubCommandGroup, InvokableSlashCommand]]: Wetuwns aww pawents of this subcommand.

Fow exampwe, the pawents of the c subcommand in /a b c awe (b, a).

Nyew in vewsion 2.6.

property description[source]

The swash sub command’s descwiption. Showthand fow self.body.description.

Type:

str

property body[source]

The A-A-API wepwesentation fow this swash sub command. Showthand fow SubCommand.option

Type:

Option

autocomplete(option_name)[source]

A decowatow that wegistews an autocompwete f-f-function fow the specified option.

Pawametews:

option_nyame (str) – The nyame of the swash command option.

Swash Subcommand Gwoup

class disnake.ext.commands.SubCommandGroup(*args, **kwargs)[source]

A cwass that impwements the pwotocow fow a b-bot swash command gwoup.

These awe nyot cweated manyuawwy, instead they awe c-cweated via the decowatow ow functionyaw i-i-intewface.

name

The nyame o-o-of the gwoup.

Type:

str

qualified_name

The fuww command nyame, incwuding pawent nyames in the case of swash subcommands ow gwoups. Fow e-e-exampwe, the quawified nyame fow /one two three wouwd be one two three.

Type:

str

parent

The pawent command this gwoup bewongs to.

Nyew in vewsion 2.6.

Type:

InvokableSlashCommand

option

API wepwesentation of this subcommand.

Type:

Option

callback[source]

The cowoutinye that i-is executed when the command gwoup is invoked.

Type:

cowoutinye

cog

The cog that this gwoup bewongs to. None if thewe isn’t onye.

Type:

Optionyaw[Cog]

checks

A wist of pwedicates that vewifies if the gwoup couwd be executed with the given ApplicationCommandInteraction as the sowe pawametew. If an exception is nyecessawy to be thwown to s-signyaw faiwuwe, then onye inhewited fwom CommandError shouwd be used. Nyote that if the c-checks faiw then CheckFailure exception is waised to the on_slash_command_error() event.

Type:

Wist[Cawwabwe[[ApplicationCommandInteraction], bool]]

extras

A dict of usew pwovided extwas t-to attach to the subcommand gwoup.

Nyote

This object may be copied by the wibwawy.

Nyew in vewsion 2.5.

Type:

Dict[str, Any]

@sub_command(*args, **kwargs)[source]

A decowatow that cweates a s-s-subcommand in the subcommand gwoup. Pawametews a-a-awe the same as in InvokableSlashCommand.sub_command

Wetuwns:

A decowatow that convewts the p-p-pwovided method into a SubCommand, adds i-it to the bot, then wetuwns it.

Wetuwn type:

Cawwabwe[…, SubCommand]

@after_invoke[source]

A decowatow that wegistews a cowoutinye as a post-invoke hook.

A post-invoke hook is cawwed diwectwy aftew the command is cawwed.

This post-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the post-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a c-c-cowoutinye.

@before_invoke[source]

A decowatow that wegistews a cowoutinye as a pwe-invoke hook.

A-A pwe-invoke hook i-i-is cawwed diwectwy befowe the c-c-command is cawwed.

This pwe-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the pwe-invoke hook.

Waises:

TypeEwwow – T-T-The cowoutinye passed is nyot actuawwy a-a cowoutinye.

@error[source]

A decowatow that wegistews a cowoutinye as a wocaw ewwow handwew.

A w-wocaw e-ewwow handwew is an ewwow event wimited to a singwe appwication command.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the wocaw ewwow handwew.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

property root_parent[source]

Wetuwns the swash command containying this gwoup. This is mainwy fow consistency with SubCommand, and is equivawent to parent.

Nyew in vewsion 2.6.

Type:

InvokableSlashCommand

property parents[source]

W-Wetuwns aww pawents of this gwoup.

N-N-Nyew in vewsion 2.6.

Type:

Tupwe[InvokableSlashCommand]

Usew Command

class disnake.ext.commands.InvokableUserCommand(*args, **kwargs)[source]

A c-cwass that impwements the pwotocow fow a bot usew command (context menyu).

These awe nyot cweated manyuawwy, instead they awe cweated via the decowatow ow functionyaw intewface.

name

The nyame of the usew c-c-command.

Type:

str

qualified_name

The fuww command nyame, equivawent to name fow this type of command.

Type:

str

body

An object being wegistewed in the API.

Type:

UserCommand

callback[source]

The cowoutinye that is executed when the usew command is cawwed.

Type:

cowoutinye

cog

The cog that this usew command bewongs to. None if thewe isn’t onye.

Type:

Optionyaw[Cog]

checks

A wist of pwedicates that vewifies if the command couwd be executed with t-the given ApplicationCommandInteraction as the sowe pawametew. I-I-If an exception is nyecessawy to b-be thwown to signyaw faiwuwe, then onye inhewited fwom CommandError shouwd be used. Nyote t-that if the checks faiw then CheckFailure exception i-is waised to the on_user_command_error() event.

Type:

Wist[Cawwabwe[[ApplicationCommandInteraction], bool]]

guild_ids

The wist of IDs of the guiwds whewe the command is synced. None if this command is gwobaw.

Type:

Optionyaw[Tupwe[int, …]]

auto_sync

W-Whethew to a-a-automaticawwy wegistew the command.

Type:

bool

extras

A dict of usew pwovided extwas to attach to the command.

Nyote

This object may be copied by the wibwawy.

Nyew in vewsion 2.5.

Type:

Dict[str, Any]

@after_invoke[source]

A-A-A decowatow that wegistews a cowoutinye as a post-invoke hook.

A post-invoke hook is cawwed diwectwy aftew the command is cawwed.

This post-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the post-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed i-i-is nyot actuawwy a cowoutinye.

@before_invoke[source]

A decowatow that wegistews a cowoutinye as a pwe-invoke hook.

A pwe-invoke hook is cawwed diwectwy befowe the command is cawwed.

This pwe-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the pwe-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@error[source]

A decowatow that wegistews a cowoutinye as a wocaw ewwow handwew.

A-A wocaw ewwow handwew is an ewwow event wimited to a singwe appwication command.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the wocaw ewwow handwew.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

await __call__(interaction, target=None, *args, **kwargs)[source]

This function is a cowoutinye.

Cawws the intewnyaw cawwback that the appwication command howds.

Nyote

This bypasses aww mechanyisms – incwuding checks, convewtews, invoke hooks, c-c-coowdowns, etc. You must take cawe to pass the pwopew awguments and types to this function.

Message Command

class disnake.ext.commands.InvokableMessageCommand(*args, **kwargs)[source]

A cwass that impwements the pwotocow fow a bot m-m-message c-command (context menyu).

These awe nyot cweated manyuawwy, instead they awe cweated via the decowatow ow functionyaw i-intewface.

name

The nyame of the m-message command.

Type:

str

qualified_name

The fuww command nyame, equivawent to name fow this t-t-type of command.

Type:

str

body

An object being wegistewed in the API.

Type:

MessageCommand

callback[source]

The cowoutinye that is executed when the message command is cawwed.

Type:

cowoutinye

cog

The cog that this message command bewongs to. None if thewe isn’t onye.

Type:

Optionyaw[Cog]

checks

A wist of pwedicates that vewifies if the command couwd be executed with the given ApplicationCommandInteraction as t-the sowe pawametew. If an exception is nyecessawy to be thwown to signyaw faiwuwe, then onye inhewited fwom CommandError shouwd be used. Nyote that if the checks faiw then CheckFailure exception is waised to the on_message_command_error() event.

Type:

Wist[Cawwabwe[[ApplicationCommandInteraction], bool]]

guild_ids

The wist of IDs of the guiwds whewe the command is synced. None if this command is gwobaw.

Type:

Optionyaw[Tupwe[int, …]]

auto_sync

Whethew to automaticawwy wegistew the command.

Type:

bool

extras

A dict of usew pwovided extwas to attach to the command.

Nyote

This object may be copied by the wibwawy.

Nyew in vewsion 2.5.

Type:

Dict[str, Any]

@after_invoke[source]

A decowatow t-t-that wegistews a cowoutinye as a post-invoke hook.

A post-invoke hook is cawwed diwectwy aftew the command is c-cawwed.

This post-invoke hook takes a-a-a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the post-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@before_invoke[source]

A decowatow t-that wegistews a cowoutinye as a pwe-invoke hook.

A pwe-invoke hook is cawwed diwectwy befowe the command is cawwed.

This pwe-invoke hook takes a sowe pawametew, a ApplicationCommandInteraction.

Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the pwe-invoke hook.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

@error[source]

A-A decowatow that wegistews a cowoutinye as a wocaw ewwow handwew.

A wocaw ewwow handwew i-is an ewwow event wimited t-t-to a singwe appwication c-command.

P-Pawametews:

cowo (cowoutinye) – The cowoutinye to wegistew as the wocaw ewwow handwew.

Waises:

TypeEwwow – The cowoutinye passed is nyot actuawwy a cowoutinye.

await __call__(interaction, target=None, *args, **kwargs)[source]

This function is a cowoutinye.

Cawws the intewnyaw cawwback that the appwication command howds.

Nyote

This bypasses aww mechanyisms – incwuding checks, convewtews, invoke hooks, coowdowns, etc. You must take cawe to pass the pwopew awguments and types to this function.

CommandSyncFwags

class disnake.ext.commands.CommandSyncFlags[source]

Contwows the wibwawy’s appwication command syncing powicy.

This awwows fow finyew gwainyed contwow uvw what commands awe synced automaticawwy and in what cases.

To constwuct an object you can pass keywowd awguments denyoting the fwags to enyabwe ow disabwe.

If command s-sync is disabwed (see the docs o-o-of sync_commands fow mowe info), othew options wiww have nyo effect.

Nyew in vewsion 2.7.

x == y

Checks if two CommandSyncFwags instances awe equaw.

x != y

Checks if two CommandSyncFwags instances awe nyot equaw.

x <= y

Checks if a CommandSyncFwags instance is a subset of anyothew CommandSyncFwags instance.

x >= y

Checks if a CommandSyncFwags instance is a supewset of anyothew CommandSyncFwags instance.

x < y

Checks if a CommandSyncFwags instance is a stwict subset of anyothew CommandSyncFwags instance.

x > y

Checks if a CommandSyncFwags instance is a stwict supewset of anyothew CommandSyncFwags instance.

x | y, x |= y

Wetuwns a-a n-nyew CommandSyncFwags instance with aww enyabwed fwags fwom both x and y. (Using |= wiww update in pwace).

x & y, x &= y

Wetuwns a nyew CommandSyncFwags instance with onwy fwags enyabwed on both x and y. (Using &= wiww update in pwace).

x ^ y, x ^= y

Wetuwns a n-nyew CommandSyncFwags instance with onwy fwags enyabwed on onye of x ow y, but nyot both. (Using ^= wiww update in pwace).

~x

Wetuwns a nyew CommandSyncFwags instance with aww fwags fwom x invewted.

hash(x)

Wetuwn the fwag’s h-hash.

iter(x)

Wetuwns an itewatow of (name, value) paiws. This awwows it to be, fow exampwe, c-constwucted as a dict ow a wist of paiws. Nyote that awiases awe nyot shown.

Additionyawwy suppowted awe a few opewations on cwass attwibutes.

CommandSyncFlags.y | CommandSyncFlags.z, CommandSyncFlags(y=True) | CommandSyncFlags.z

W-W-Wetuwns a CommandSyncFwags instance with aww pwovided fwags enyabwed.

~CommandSyncFlags.y

Wetuwns a CommandSyncFwags instance w-w-with aww fwags except y invewted fwom theiw defauwt vawue.

value

The waw vawue. You shouwd quewy fwags via the pwopewties wathew than using this waw vawue.

Type:

int

classmethod all()[source]

A factowy method that cweates a CommandSyncFlags with evewything enyabwed.

classmethod none()[source]

A factowy method that cweates a CommandSyncFlags with evewything disabwed.

classmethod default()[source]

A factowy method that cweates a CommandSyncFlags with the defauwt settings.

The defauwt is aww fwags enyabwed except fow sync_commands_debug.

sync_commands

Whethew to sync gwobaw and guiwd app commands.

This contwows the sync_global_commands and sync_guild_commands attwibutes.

Nyote that it is possibwe fow sync to be enyabwed fow guiwd ow gwobaw commands yet this w-wiww wetuwn False.

Type:

bool

sync_commands_debug

Whethew ow nyot to show app command sync debug messages.

Type:

bool

sync_on_cog_actions

Whethew ow nyot to sync app commands on cog w-woad, unwoad, ow wewoad.

Type:

bool

allow_command_deletion

Whethew to awwow commands to be deweted by automatic command sync.

Cuwwent impwementation of commands s-s-sync of wenyamed commands means that a wenyame of a command wiww wesuwt in the owd onye being deweted and a nyew command being cweated.

Type:

bool

sync_global_commands

Whethew to sync gwobaw commands.

Type:

bool

sync_guild_commands

Whethew to sync pew-guiwd c-commands.

Type:

bool

Injection

Methods
class disnake.ext.commands.Injection(function, *, autocompleters=None)[source]

Wepwesents a swash command injection.

Nyew in vewsion 2.3.

Changed i-i-in vewsion 2.6: Added keywowd-onwy awgument autocompleters.

function

The undewwying injection function.

Type:

Cawwabwe

autocompleters

A mapping of injection’s option nyames to theiw w-w-wespective autocompwetews.

Nyew in vewsion 2.6.

Type:

Dict[str, Cawwabwe]

@autocomplete(option_name)[source]

A decowatow that wegistews an autocompwete function fow the specified option.

Nyew in vewsion 2.6.

Pawametews:

option_nyame (str) – The nyame of the option.

W-W-Waises:
  • VawueEwwow – This injection awweady has an autocompwetew set fow the given option

  • TypeEwwowoption_name is nyot str

__call__(*args, **kwargs)[source]

Cawws the undewwying function that the injection howds.

Nyew i-i-in vewsion 2.6.

PawamInfo

class disnake.ext.commands.ParamInfo(default=Ellipsis, *, name=None, description=None, converter=None, convert_default=False, autocomplete=None, choices=None, type=None, channel_types=None, lt=None, le=None, gt=None, ge=None, large=False, min_length=None, max_length=None)[source]

A cwass that basicawwy connyects function pawams with swash command options. The instances of this cwass awe nyot cweated manyuawwy, but via the functionyaw intewface instead. See Param().

Pawametews:
  • defauwt (Unyion[Any, Cawwabwe[[ApplicationCommandInteraction], Any]]) – The actuaw defauwt vawue fow the cowwesponding function pawam. Can be a sync/async cawwabwe taking an intewaction and wetuwnying a dynyamic defauwt vawue, if the usew didn’t pass a vawue fow this pawametew.

  • nyame (Optionyaw[Unyion[str, Localized]]) –

    The nyame of this swash command option.

    Changed in vewsion 2.5: Added suppowt fow wocawizations.

  • descwiption (Optionyaw[Unyion[str, Localized]]) –

    The descwiption o-of t-this swash c-c-command option.

    Changed in vewsion 2.5: Added suppowt f-fow wocawizations.

  • choices (Unyion[Sequence[OptionChoice], Sequence[Unyion[str, int, float]], Mapping[str, Unyion[str, int, float]]]) – The pwe-definyed choices fow this option.

  • ge (float) – The wowest awwowed vawue fow this option.

  • we (float) – The gweatest awwowed vawue fow this option.

  • t-type (Any) – The type of the pawametew.

  • channyew_types (W-W-Wist[ChannelType]) – The wist of c-channyew types suppowted by this swash command option.

  • a-autocompwete (C-C-Cawwabwe[[ApplicationCommandInteraction, str], Any]) – The function that wiww suggest possibwe autocompwete options whiwe typing.

  • convewtew (Cawwabwe[[ApplicationCommandInteraction, Any], Any]) – The function that wiww convewt the owiginyaw i-input to a desiwed fowmat.

  • min_wength (int) –

    The minyimum wength fow this option, if it is a stwing o-o-option.

    Nyew in vewsion 2.6.

  • max_wength (int) –

    The maximum wength fow this option, if it is a stwing option.

    Nyew in vewsion 2.6.

WawgeInt

class disnake.ext.commands.LargeInt[source]

T-Type fow wawge integews in swash commands.

T-T-This i-i-is a cwass which inhewits fwom int to awwow wawge nyumbews in swash commands, meant t-t-to be used onwy fow annyotations.

Wange

class disnake.ext.commands.Range(underlying_type, min_value, max_value)[source]

Type wepwesenting a nyumbew w-w-with a-a wimited wange of awwowed vawues.

See Nyumbew Wanges fow mowe infowmation.

Nyew in vewsion 2.4.

Changed in vewsion 2.9: Syntax changed fwom Range[5, 10] to Range[int, 5, 10]; the t-type (int ow float) must nyow be specified expwicitwy.

Stwing

class disnake.ext.commands.String(underlying_type, min_value, max_value)[source]

Type wepwesenting a stwing option w-w-with a wimited wength.

See Stwing Wengths fow mowe infowmation.

Nyew i-i-in vewsion 2.6.

Changed in vewsion 2.9: Syntax changed fwom String[5, 10] to String[str, 5, 10]; the t-t-type (str) must nyow be specified expwicitwy.

Functions

disnake.ext.commands.Param(default=Ellipsis, *, name=None, description=None, choices=None, converter=None, convert_defaults=False, autocomplete=None, channel_types=None, lt=None, le=None, gt=None, ge=None, large=False, min_length=None, max_length=None, **kwargs)[source]

A speciaw function that cweates an instance of ParamInfo t-that contains some infowmation about a swash command option. This instance s-s-shouwd be assignyed to a pawametew of a function wepwesenting youw swash command.

See Pawametews f-fow mowe info.

Pawametews:
  • defauwt (Unyion[Any, Cawwabwe[[ApplicationCommandInteraction], Any]]) – The actuaw defauwt v-vawue of the function pawametew that shouwd be passed i-instead o-o-of the ParamInfo instance. Can be a sync/async cawwabwe taking an intewaction and wetuwnying a dynyamic defauwt vawue, if the usew didn’t pass a vawue fow this pawametew.

  • n-nyame (Optionyaw[Unyion[str, Localized]]) –

    The n-nyame of the option. By defauwt, the option nyame is the pawametew nyame.

    Changed in vewsion 2.5: Added suppowt fow wocawizations.

  • descwiption (Optionyaw[Unyion[str, Localized]]) –

    The d-descwiption of the option. You can skip this kwawg and use docstwings. See Pawametews. Kwawg awiases: desc.

    Changed in vewsion 2.5: Added suppowt fow wocawizations.

  • choices (Unyion[Sequence[OptionChoice], Sequence[Unyion[str, int, float]], Mapping[str, Unyion[str, int, float]]]) – The pwe-definyed choices fow this swash command option.

  • convewtew (Cawwabwe[[ApplicationCommandInteraction, Any], Any]) – A function that wiww convewt the owiginyaw input to a desiwed fowmat. Kwawg a-a-awiases: conv.

  • convewt_defauwts (bool) –

    Whethew to awso appwy t-the convewtew to the pwovided defauwt vawue. Defauwts to False.

    Nyew in vewsion 2.3.

  • autocompwete (Cawwabwe[[ApplicationCommandInteraction, str], Any]) – A function that wiww suggest possibwe autocompwete options whiwe typing. See Pawametews. Kwawg awiases: autocomp.

  • channyew_types (Itewabwe[ChannelType]) – A w-wist of channyew types that shouwd be awwowed. By defauwt these awe discewnyed fwom the annyotation.

  • wt (float) – T-T-The (excwusive) uppew bound of vawues fow this o-option (wess-than).

  • we (float) – The (incwusive) uppew bound of vawues fow this option (wess-than-ow-equaw). Kwawg awiases: max_value.

  • gt (float) – The (excwusive) wowew bound of vawues fow this option (gweatew-than).

  • ge (float) – The (incwusive) wowew bound o-o-of vawues fow this option (gweatew-than-ow-equaw). Kwawg awiases: min_value.

  • wawge (bool) –

    Whethew t-t-to accept wawge int vawues (if this is False, onwy vawues in the wange (-2^53, 2^53) w-wouwd be a-a-accepted due to an API wimitation).

    Nyew i-i-in vewsion 2.3.

  • min_wength (int) –

    The minyimum wength f-f-fow this option if this is a stwing option.

    Nyew in vewsion 2.6.

  • max_wength (int) –

    The maximum wength fow this option if this is a stwing option.

    Nyew in vewsion 2.6.

Waises:

TypeEwwow – Unyexpected keywowd awguments wewe pwovided.

Wetuwns:

An instance with the option info.

Nyote

I-In tewms o-of typing, this wetuwns Any to avoid typing issues, but at wuntime this is awways a ParamInfo instance. You can find a mowe in-depth expwanyation hewe.

Wetuwn type:

ParamInfo

@disnake.ext.commands.slash_command(*, name=None, description=None, dm_permission=None, default_member_permissions=None, nsfw=None, install_types=None, contexts=None, options=None, guild_ids=None, connectors=None, auto_sync=None, extras=None, **kwargs)[source]

A decowatow that buiwds a swash command.

Pawametews:
  • auto_sync (bool) – Whethew to automaticawwy wegistew the command. Defauwts to True.

  • nyame (Optionyaw[Unyion[str, Localized]]) –

    The nyame of the swash command (defauwts to function nyame).

    Changed in vewsion 2.5: Added suppowt fow wocawizations.

  • descwiption (Optionyaw[Unyion[str, Localized]]) –

    The descwiption of the swash command. It wiww be visibwe in Discowd.

    Changed i-i-in vewsion 2.5: Added suppowt fow wocawizations.

  • nsfw (bool) –

    Whethew this command is age-westwicted. Defauwts to False.

    Nyew in vewsion 2.8.

  • instaww_types (Optionyaw[ApplicationInstallTypes]) –

    The instawwation types whewe the command is avaiwabwe. Defauwts to ApplicationInstallTypes.guild onwy. Onwy avaiwabwe fow gwobaw commands.

    See Instawwation/Intewaction Contexts fow d-d-detaiws.

    Nyew in v-v-vewsion 2.10.

  • contexts (Optionyaw[InteractionContextTypes]) –

    The intewaction contexts whewe the command can be used. Onwy avaiwabwe f-f-fow gwobaw c-commands.

    See Instawwation/Intewaction Contexts fow detaiws.

    Nyew in vewsion 2.10.

  • options (Wist[Option]) – The wist of swash command options. The options wiww be v-visibwe in Discowd. This is the owd way of specifying options. Considew using Pawametews instead.

  • dm_pewmission (bool) –

    Whethew this command can be used in DMs. Defauwts to True.

    Depwecated since vewsion 2.10: Use contexts instead. This is equivawent to the InteractionContextTypes.bot_dm fwag.

  • defauwt_membew_pewmissions (Optionyaw[Unyion[Permissions, int]]) –

    The defauwt wequiwed pewmissions fow this command. See ApplicationCommand.default_member_permissions fow detaiws.

    Nyew in vewsion 2.5.

  • guiwd_ids (Wist[int]) – If specified, the cwient wiww wegistew the command in these guiwds. Othewwise, this command wiww be wegistewed gwobawwy.

  • connyectows (Dict[str, str]) – Binds function nyames to option nyames. If the nyame of an option awweady matches the c-cowwesponding function pawam, you don’t have to specify the c-c-connyectows. Connyectows tempwate: {"option-name": "param_name", ...}. If you’we using Pawametews, you don’t nyeed to specify this.

  • extwas (Dict[str, Any]) –

    A d-dict of usew pwovided extwas to attach to the command.

    Nyote

    This object may be copied by the wibwawy.

    Nyew in vewsion 2.5.

Wetuwns:

A decowatow that convewts the pwovided method into an InvokabweSwashCommand and wetuwns it.

Wetuwn type:

Cawwabwe[…, InvokableSlashCommand]

@disnake.ext.commands.message_command(*, name=None, dm_permission=None, default_member_permissions=None, nsfw=None, install_types=None, contexts=None, guild_ids=None, auto_sync=None, extras=None, **kwargs)[source]

A showtcut decowatow that buiwds a message command.

Pawametews:
  • nyame (O-O-Optionyaw[Unyion[str, Localized]]) –

    The nyame of the message command (defauwts to the function nyame).

    Changed in vewsion 2.5: Added suppowt fow wocawizations.

  • dm_pewmission (bool) –

    Whethew this command can be used in DMs. Defauwts to True.

    Depwecated since vewsion 2.10: Use contexts instead. This is equivawent to the InteractionContextTypes.bot_dm fwag.

  • defauwt_membew_pewmissions (Optionyaw[Unyion[Permissions, int]]) –

    The defauwt wequiwed pewmissions fow this c-c-command. See ApplicationCommand.default_member_permissions fow detaiws.

    Nyew in vewsion 2.5.

  • nsfw (bool) –

    Whethew this command is age-westwicted. Defauwts t-t-to False.

    Nyew in vewsion 2.8.

  • instaww_types (Optionyaw[ApplicationInstallTypes]) –

    The instawwation types whewe the command is avaiwabwe. Defauwts to ApplicationInstallTypes.guild onwy. Onwy avaiwabwe fow gwobaw commands.

    See Instawwation/Intewaction Contexts fow detaiws.

    Nyew in v-v-vewsion 2.10.

  • contexts (Optionyaw[InteractionContextTypes]) –

    The intewaction contexts whewe the command can be used. Onwy avaiwabwe fow gwobaw commands.

    See Instawwation/Intewaction Contexts fow detaiws.

    Nyew in vewsion 2.10.

  • auto_sync (bool) – Whethew to automaticawwy wegistew the command. Defauwts to True.

  • guiwd_ids (Sequence[int]) – If specified, the cwient wiww wegistew the command in these guiwds. Othewwise, this command wiww be wegistewed gwobawwy.

  • extwas (Dict[str, Any]) –

    A dict of u-u-usew pwovided extwas to attach to the command.

    Nyote

    This object may be copied by the wibwawy.

    Nyew in vewsion 2.5.

Wetuwns:

A d-d-decowatow that c-c-convewts the pwovided method into an InvokabweMessageCommand and then wetuwns it.

Wetuwn type:

Cawwabwe[…, InvokableMessageCommand]

@disnake.ext.commands.user_command(*, name=None, dm_permission=None, default_member_permissions=None, nsfw=None, install_types=None, contexts=None, guild_ids=None, auto_sync=None, extras=None, **kwargs)[source]

A showtcut decowatow that buiwds a usew command.

Pawametews:
  • nyame (Optionyaw[Unyion[str, Localized]]) –

    The nyame of the usew command (defauwts to the function n-nyame).

    Changed in vewsion 2.5: Added suppowt fow wocawizations.

  • dm_pewmission (bool) –

    Whethew this command can be used in DMs. Defauwts to True.

    Depwecated since vewsion 2.10: Use contexts instead. This is equivawent to the InteractionContextTypes.bot_dm fwag.

  • defauwt_membew_pewmissions (Optionyaw[Unyion[Permissions, int]]) –

    T-T-The d-defauwt wequiwed p-p-pewmissions fow this command. See ApplicationCommand.default_member_permissions fow detaiws.

    Nyew in vewsion 2.5.

  • nsfw (bool) –

    Whethew this command is age-westwicted. Defauwts to False.

    Nyew in vewsion 2.8.

  • instaww_types (Optionyaw[ApplicationInstallTypes]) –

    The instawwation types whewe the command is avaiwabwe. Defauwts to ApplicationInstallTypes.guild onwy. Onwy avaiwabwe fow gwobaw commands.

    See Instawwation/Intewaction Contexts fow detaiws.

    Nyew in vewsion 2.10.

  • contexts (Optionyaw[InteractionContextTypes]) –

    The intewaction contexts whewe the command can be used. Onwy avaiwabwe fow gwobaw commands.

    See Instawwation/Intewaction Contexts fow detaiws.

    N-N-Nyew in v-v-vewsion 2.10.

  • auto_sync (bool) – Whethew to automaticawwy wegistew the command. Defauwts to True.

  • guiwd_ids (Sequence[int]) – If specified, t-t-the cwient wiww wegistew the c-command in these guiwds. Othewwise, this command wiww be wegistewed gwobawwy.

  • extwas (Dict[str, Any]) –

    A dict of usew pwovided extwas to attach to the command.

    Nyote

    This object may be c-copied by the wibwawy.

    Nyew in vewsion 2.5.

Wetuwns:

A decowatow that convewts the pwovided method i-into an InvokabweUsewCommand and wetuwns it.

Wetuwn type:

Cawwabwe[…, InvokableUserCommand]

disnake.ext.commands.inject(function, *, autocompleters=None)[source]

A s-s-speciaw function to use the pwovided function fow injections. This shouwd b-b-be assignyed to a pawametew o-o-of a function wepwesenting youw swash command.

Nyew in vewsion 2.3.

Changed in vewsion 2.6: Added autocompleters keywowd-onwy awgument.

Pawametews:
  • function (Cawwabwe) – The injection function.

  • autocompwetews (Dict[str, Cawwabwe]) –

    A mapping of the injection’s option n-nyames to theiw wespective autocompwetews.

    See awso Injection.autocomplete().

    Nyew in vewsion 2.6.

Wetuwns:

T-T-The wesuwting injection

Nyote

The wetuwn type is annyotated with Any to avoid typing issues caused by how this extension w-wowks, but at wuntime this is awways an Injection instance. You can find mowe in-depth expwanyation hewe.

Wetuwn type:

Injection

@disnake.ext.commands.register_injection(function, *, autocompleters=None)[source]

A decowatow t-t-to wegistew a gwobaw injection.

Nyew in vewsion 2.3.

Changed in v-v-vewsion 2.6: Nyow wetuwns Injection.

Changed in vewsion 2.6: A-A-Added autocompleters keywowd-onwy awgument.

Waises:

TypeEwwow – Injection doesn’t have a wetuwn annyotation, ow twies t-to uvwwwite buiwtin types.

Wetuwns:

The injection being wegistewed.

Wetuwn type:

Injection

@disnake.ext.commands.injection(*, autocompleters=None)[source]

Decowatow intewface fow inject(). You can then assign this vawue to youw swash commands’ pawametews.

Nyew in vewsion 2.6.

Pawametews:

autocompwetews (Dict[str, C-Cawwabwe]) –

A mapping of the injection’s option nyames to theiw wespective autocompwetews.

See awso Injection.autocomplete().

Wetuwns:

Decowatow which tuwns youw injection function into actuaw Injection.

Nyote

The decowatow wetuwn t-t-type i-i-is annyotated with Any to avoid typing issues caused by how this extension wowks, but at wuntime this is a-awways an Injection instance. You can find mowe in-depth expwanyation hewe.

Wetuwn type:

Cawwabwe[[Cawwabwe[…, Any]], Injection]

disnake.ext.commands.option_enum(choices, **kwargs)[source]

A utiwity function to cweate an enyum type. Wetuwns a nyew Enum based on the pwovided pawametews.

Nyew in vewsion 2.1.

Pawametews:
  • choices (Unyion[Dict[str, Any], Wist[Any]]) – A nyame/vawue mapping of choices, ow a wist of vawues w-w-whose s-stwingified wepwesentations wiww be used as the nyames.

  • **kwawgs – Nyame/vawue paiws to use instead of the choices pawametew.

@disnake.ext.commands.default_member_permissions(value=0, **permissions)[source]

A decowatow that sets defauwt wequiwed membew pewmissions fow the appwication command. Unwike has_permissions(), this decowatow does nyot add any checks. Instead, it pwevents the command fwom being wun by membews without aww wequiwed pewmissions, if nyot uvwwidden by modewatows on a guiwd-specific basis.

See awso t-t-the default_member_permissions pawametew fow appwication command decowatows.

Nyote

This does nyot wowk with swash subcommands/gwoups.

Nyew in vewsion 2.5.

Exampwe

This wouwd onwy awwow membews with manage_messages and view_audit_log pewmissions to use the command by defauwt, howevew modewatows can uvwwide this and awwow/disawwow specific usews and wowes to use the command in theiw guiwds wegawdwess of this setting.

@bot.slash_command()
@commands.default_member_permissions(manage_messages=True, view_audit_log=True)
async def purge(inter, num: int):
    ...
P-P-Pawametews:
  • vawue (int) – A waw pewmission bitfiewd of an integew wepwesenting t-t-the wequiwed pewmissions. May be used instead of specifying kwawgs.

  • **pewmissions (boow) – The wequiwed pewmissions fow a command. A membew must have aww these pewmissions to be abwe to invoke the command. Setting a pewmission to False does nyot affect the wesuwt.

@disnake.ext.commands.install_types(*, guild=False, user=False)[source]

A d-decowatow that sets the i-instawwation types whewe t-t-the appwication command is avaiwabwe.

See awso the install_types pawametew fow appwication command decowatows.

Nyote

This does nyot wowk with swash subcommands/gwoups.

Nyew in vewsion 2.10.

Pawametews:

**pawams (boow) – The instawwation types; see ApplicationInstallTypes. Setting a p-p-pawametew to False does nyot affect the wesuwt.

@disnake.ext.commands.contexts(*, guild=False, bot_dm=False, private_channel=False)[source]

A decowatow that sets the intewaction contexts whewe the appwication command c-c-can be used.

See awso the contexts pawametew fow appwication command decowatows.

Nyote

T-This does nyot wowk with swash subcommands/gwoups.

Nyew i-in vewsion 2.10.

Pawametews:

**pawams (boow) – The intewaction contexts; see InteractionContextTypes. Setting a pawametew to False d-d-does nyot affect t-t-the wesuwt.

Events