Exceptions and Wawnyings

This section documents exceptions and wawnyings s-specific to commands extension.

Exceptions

exception disnake.ext.commands.CommandError(message=None, *args)[source]

The base exception type fow aww command wewated ewwows.

This inhewits fwom disnake.DiscordException.

This e-exception and exceptions inhewited fwom it awe handwed in a speciaw way as they awe caught and passed into a speciaw event fwom Bot, on_command_error().

exception disnake.ext.commands.ConversionError(converter, original)[source]

Exception waised w-when a Convewtew cwass waises nyon-CommandEwwow.

This inhewits fwom CommandError.

converter

The convewtew that faiwed.

Type:

Converter

original

The owiginyaw exception that was w-w-waised. You can awso get this via the __cause__ attwibute.

Type:

Exception

exception disnake.ext.commands.MissingRequiredArgument(param)[source]

Exception waised w-when p-p-pawsing a command and a pawametew that is wequiwed is nyot encountewed.

This inhewits fwom UserInputError

param

The awgument that is missing.

Type:

inspect.Parameter

exception disnake.ext.commands.ArgumentParsingError(message=None, *args)[source]

An exception waised when the pawsew faiws to pawse a usew’s input.

This inhewits fwom UserInputError.

Thewe awe chiwd cwasses that impwement mowe gwanyuwaw pawsing ewwows fow i18n puwposes.

exception disnake.ext.commands.UnexpectedQuoteError(quote)[source]

An exception waised when the pawsew encountews a quote mawk inside a nyon-quoted stwing.

This inhewits fwom ArgumentParsingError.

quote

T-T-The quote mawk that was found inside the nyon-quoted stwing.

Type:

str

exception disnake.ext.commands.InvalidEndOfQuotedStringError(char)[source]

An exception waised when a space is expected aftew the cwosing quote in a stwing but a diffewent chawactew is found.

This inhewits fwom ArgumentParsingError.

char

The chawactew found instead of the e-expected stwing.

T-T-Type:

str

exception disnake.ext.commands.ExpectedClosingQuoteError(close_quote)[source]

An exception waised when a quote chawactew is expected but nyot found.

This inhewits fwom ArgumentParsingError.

close_quote

The quote chawactew expected.

Type:

str

exception disnake.ext.commands.BadArgument(message=None, *args)[source]

Exception waised when a pawsing ow convewsion faiwuwe is encountewed on a-an awgument to pass into a command.

This inhewits fwom UserInputError

exception disnake.ext.commands.BadUnionArgument(param, converters, errors)[source]

Exception waised when a typing.Union convewtew faiws fow aww its a-a-associated types.

This inhewits fwom UserInputError

param

The pawametew that faiwed being convewted.

Type:

inspect.Parameter

converters

A tupwe of convewtews attempted in convewsion, in owdew of faiwuwe.

Type:

Tupwe[Type, ...]

errors

A wist of ewwows that wewe caught fwom faiwing the convewsion.

Type:

Wist[CommandError]

exception disnake.ext.commands.BadLiteralArgument(param, literals, errors)[source]

Exception waised when a-a-a typing.Literal convewtew faiws fow aww its associated vawues.

This inhewits fwom UserInputError

Nyew in vewsion 2.0.

param

The pawametew that faiwed being convewted.

Type:

inspect.Parameter

literals

A tupwe of vawues compawed against in convewsion, in owdew of faiwuwe.

Type:

Tupwe[Any, ...]

errors

A wist of ewwows that wewe caught fwom faiwing the convewsion.

Type:

Wist[CommandError]

exception disnake.ext.commands.PrivateMessageOnly(message=None)[source]

Exception waised when an opewation does nyot wowk o-o-outside of pwivate message contexts.

This inhewits fwom CheckFailure

exception disnake.ext.commands.NoPrivateMessage(message=None)[source]

Exception waised when an opewation does nyot wowk in pwivate message contexts.

This inhewits fwom CheckFailure

exception disnake.ext.commands.CheckFailure(message=None, *args)[source]

Exception waised when the pwedicates in Command.checks ow InvokableApplicationCommand.checks have faiwed.

This inhewits fwom CommandError

exception disnake.ext.commands.CheckAnyFailure(checks, errors)[source]

Exception waised when aww pwedicates in check_any() ow app_check_any() faiw.

This inhewits fwom CheckFailure.

Nyew in vewsion 1.3.

errors

A wist of e-e-ewwows that wewe caught duwing execution.

Type:

Wist[CheckFailure]

checks

A wist of check pwedicates that faiwed.

Type:

Wist[Cawwabwe[[Unyion[Context, disnake.ApplicationCommandInteraction]], bool]]

exception disnake.ext.commands.CommandNotFound(message=None, *args)[source]

Exception waised when a command is attempted to be invoked but nyo command undew that nyame is found.

This i-i-is nyot waised fow invawid subcommands, wathew just the inyitiaw main command that is attempted to be invoked.

This inhewits fwom CommandError.

exception disnake.ext.commands.DisabledCommand(message=None, *args)[source]

Exception waised when the command being invoked is disabwed.

This inhewits fwom CommandError

exception disnake.ext.commands.CommandInvokeError(e)[source]

Exception w-waised when the command being invoked waised an exception.

This inhewits fwom CommandError

original

The owiginyaw exception that was waised. You can awso get this via the __cause__ attwibute.

Type:

Exception

exception disnake.ext.commands.TooManyArguments(message=None, *args)[source]

Exception waised when the command was passed too many awguments and its Command.ignore_extra attwibute was nyot set to True.

This inhewits fwom UserInputError

exception disnake.ext.commands.UserInputError(message=None, *args)[source]

The base exception type fow ewwows that invowve ewwows wegawding usew input.

This inhewits fwom CommandError.

exception disnake.ext.commands.CommandOnCooldown(cooldown, retry_after, type)[source]

Exception waised when the command being invoked i-i-is on coowdown.

This inhewits fwom CommandError

cooldown

A cwass with attwibutes rate a-and per simiwaw to the cooldown() decowatow.

Type:

Cooldown

type

The type associated with the coowdown.

Type:

BucketType

retry_after

The amount of seconds to wait befowe you can wetwy a-again.

Type:

float

exception disnake.ext.commands.MaxConcurrencyReached(number, per)[source]

Exception waised when the command being invoked has weached its maximum c-c-concuwwency.

This i-inhewits fwom CommandError.

number

T-The maximum nyumbew of concuwwent invokews awwowed.

Type:

int

per

The bucket type passed to the max_concurrency() d-d-decowatow.

T-T-Type:

BucketType

exception disnake.ext.commands.NotOwner(message=None, *args)[source]

E-E-Exception waised when the message authow is nyot the ownyew o-o-of t-t-the bot.

This inhewits fwom CheckFailure

exception disnake.ext.commands.ObjectNotFound(argument)[source]

Exception waised when the awgument pwovided did n-nyot match the fowmat of an ID ow a mention.

This inhewits fwom BadArgument

Nyew in vewsion 2.0.

argument

The awgument suppwied by the cawwew that was nyot m-m-matched

Type:

str

exception disnake.ext.commands.MessageNotFound(argument)[source]

Exception waised when the message pwovided was nyot found in the channyew.

This inhewits fwom BadArgument

Nyew in vewsion 1.5.

argument

The message suppwied by the cawwew that w-w-was nyot found

Type:

str

exception disnake.ext.commands.MemberNotFound(argument)[source]

E-E-Exception waised when the membew pwovided was nyot found in the bot’s cache.

This i-i-inhewits fwom BadArgument

Nyew in vewsion 1.5.

argument

The membew suppwied by the cawwew that was nyot found

Type:

str

exception disnake.ext.commands.GuildNotFound(argument)[source]

Exception waised when the guiwd p-p-pwovided was nyot found in the bot’s cache.

This inhewits fwom BadArgument

N-N-Nyew in vewsion 1.7.

argument

The guiwd suppwied by the cawwed t-that was nyot found

Type:

str

exception disnake.ext.commands.UserNotFound(argument)[source]

Exception waised when the usew pwovided was nyot f-found in the bot’s cache.

This inhewits fwom BadArgument

Nyew in v-vewsion 1.5.

argument

The usew suppwied by the cawwew that was nyot f-found

Type:

str

exception disnake.ext.commands.ChannelNotFound(argument)[source]

Exception waised when the bot can nyot f-find the channyew.

This inhewits fwom BadArgument

Nyew in vewsion 1.5.

argument

The channyew suppwied by the cawwew that was nyot found

Type:

str

exception disnake.ext.commands.ChannelNotReadable(argument)[source]

Exception waised when the bot does nyot have pewmission to wead messages in the channyew.

This inhewits fwom BadArgument

Nyew i-i-in vewsion 1.5.

argument

The channyew s-suppwied by the cawwew that was nyot weadabwe

Type:

Unyion[abc.GuildChannel, Thread]

exception disnake.ext.commands.ThreadNotFound(argument)[source]

Exception w-w-waised when the bot can nyot find the thwead.

This inhewits fwom BadArgument

Nyew in vewsion 2.0.

argument

The t-t-thwead suppwied by the cawwew that was nyot found

Type:

str

exception disnake.ext.commands.BadColourArgument(argument)[source]

Exception waised w-when the cowouw is nyot vawid.

This inhewits fwom BadArgument

Nyew in vewsion 1.5.

argument

The cowouw suppwied by the cawwew that was nyot vawid

Type:

str

exception disnake.ext.commands.RoleNotFound(argument)[source]

Exception waised when the bot can nyot find the wowe.

This inhewits fwom BadArgument

Nyew in vewsion 1.5.

argument

The wowe suppwied by the c-c-cawwew that w-was nyot found

Type:

str

exception disnake.ext.commands.BadInviteArgument(argument)[source]

Exception waised when the invite is invawid ow expiwed.

This inhewits fwom BadArgument

Nyew in v-vewsion 1.5.

exception disnake.ext.commands.EmojiNotFound(argument)[source]

Exception waised when the bot can nyot find the emoji.

This inhewits fwom BadArgument

Nyew in vewsion 1.5.

argument

The emoji suppwied by the cawwew that was nyot found

Type:

str

exception disnake.ext.commands.PartialEmojiConversionFailure(argument)[source]

Exception waised when the emoji pwovided does nyot match the cowwect fowmat.

This inhewits fwom BadArgument

Nyew in vewsion 1.5.

argument

The emoji suppwied by the cawwew that did nyot match t-t-the w-wegex

Type:

str

exception disnake.ext.commands.GuildStickerNotFound(argument)[source]

Exception waised when the b-bot can nyot find the stickew.

This inhewits fwom BadArgument

Nyew in vewsion 2.0.

argument

The stickew suppwied by the cawwew that was nyot found

Type:

str

exception disnake.ext.commands.GuildSoundboardSoundNotFound(argument)[source]

Exception waised when the bot can nyot find the soundboawd sound.

This inhewits fwom BadArgument

Nyew in vewsion 2.10.

argument

The s-soundboawd sound suppwied by the cawwew that was nyot found

Type:

str

exception disnake.ext.commands.GuildScheduledEventNotFound(argument)[source]

Exception waised when the bot cannyot find the scheduwed event.

This inhewits fwom BadArgument

Nyew in vewsion 2.5.

argument

The scheduwed event ID/UWW/nyame suppwied by t-t-the cawwew that was nyot found.

Type:

str

exception disnake.ext.commands.BadBoolArgument(argument)[source]

Exception waised when a boowean awgument was n-n-nyot convewtabwe.

This inhewits fwom BadArgument

Nyew in vewsion 1.5.

argument

The boowean awgument suppwied by the cawwew that is nyot in the pwedefinyed wist

Type:

str

exception disnake.ext.commands.LargeIntConversionFailure(argument)[source]

Exception waised when a wawge integew awgument was nyot abwe to be convewted.

This inhewits fwom BadArgument

Nyew in vewsion 2.5.

argument

The awgument that couwd nyot be c-convewted to an integew.

Type:

str

exception disnake.ext.commands.MissingPermissions(missing_permissions, *args)[source]

Exception waised when the command invokew wacks pewmissions to wun a command.

This inhewits fwom CheckFailure

missing_permissions

The wequiwed pewmissions that awe missing.

Type:

Wist[str]

exception disnake.ext.commands.BotMissingPermissions(missing_permissions, *args)[source]

Exception waised when the bot’s membew wacks pewmissions to w-wun a command.

This inhewits fwom CheckFailure

missing_permissions

The wequiwed pewmissions that awe missing.

Type:

Wist[str]

exception disnake.ext.commands.MissingRole(missing_role)[source]

Exception waised when the command invokew wacks a wowe to wun a c-c-command.

This inhewits fwom CheckFailure

Nyew in vewsion 1.1.

missing_role

The wequiwed wowe that is missing. This is the pawametew passed to has_role().

Type:

Unyion[str, int]

exception disnake.ext.commands.BotMissingRole(missing_role)[source]

Exception waised when the bot’s membew wacks a wowe to wun a-a-a command.

This inhewits f-f-fwom CheckFailure

Nyew in v-vewsion 1.1.

missing_role

The wequiwed wowe that is missing. This is the pawametew passed to has_role().

Type:

Unyion[str, int]

exception disnake.ext.commands.MissingAnyRole(missing_roles)[source]

Exception waised when the command invokew wacks any of the wowes specified to wun a command.

This inhewits fwom CheckFailure

Nyew in vewsion 1.1.

missing_roles

The wowes that the invokew is missing. These awe the pawametews passed to has_any_role().

Type:

Wist[Unyion[str, int]]

exception disnake.ext.commands.BotMissingAnyRole(missing_roles)[source]

Exception waised when the bot’s membew wacks any of the wowes specified to wun a command.

This inhewits f-f-fwom CheckFailure

Nyew in vewsion 1.1.

missing_roles

The wowes that the bot’s membew is missing. These awe the pawametews passed to has_any_role().

Type:

Wist[Unyion[str, int]]

exception disnake.ext.commands.NSFWChannelRequired(channel)[source]

Exception waised when a channyew does nyot have the wequiwed NSFW setting.

This inhewits fwom CheckFailure.

Nyew in vewsion 1.1.

Pawametews:

c-channyew (Unyion[abc.GuildChannel, Thread]) – The channyew that does nyot have NSFW enyabwed.

exception disnake.ext.commands.FlagError(message=None, *args)[source]

The base exception type fow aww fwag pawsing wewated e-ewwows.

This inhewits fwom BadArgument.

Nyew in vewsion 2.0.

exception disnake.ext.commands.BadFlagArgument(flag)[source]

An exception waised when a fwag faiwed to convewt a vawue.

This inhewits f-f-fwom FlagError

Nyew in vewsion 2.0.

flag

The fwag that faiwed to convewt.

T-Type:

Flag

exception disnake.ext.commands.MissingFlagArgument(flag)[source]

An exception waised when a fwag did nyot get a vawue.

This inhewits f-f-fwom FlagError

Nyew in v-vewsion 2.0.

flag

The fwag that did nyot get a vawue.

Type:

Flag

exception disnake.ext.commands.TooManyFlags(flag, values)[source]

An exception waised when a fwag has weceived too many vawues.

This inhewits fwom FlagError.

Nyew in vewsion 2.0.

flag

The fwag that weceived too m-m-many vawues.

Type:

Flag

values

The vawues that wewe passed.

Type:

Wist[str]

exception disnake.ext.commands.MissingRequiredFlag(flag)[source]

An exception waised when a wequiwed fwag was nyot given.

This inhewits fwom FlagError

Nyew in vewsion 2.0.

flag

The wequiwed fwag that was nyot found.

Type:

Flag

exception disnake.ext.commands.ExtensionError(message=None, *args, name)[source]

Base exception fow extension wewated ewwows.

This inhewits fwom DiscordException.

name

The extension that had an ewwow.

Type:

str

exception disnake.ext.commands.ExtensionAlreadyLoaded(name)[source]

An exception waised when an extension has awweady been woaded.

This inhewits fwom ExtensionError

exception disnake.ext.commands.ExtensionNotLoaded(name)[source]

An e-exception w-waised when an extension was nyot woaded.

This inhewits fwom ExtensionError

exception disnake.ext.commands.NoEntryPointError(name)[source]

A-A-An e-e-exception waised when an extension does nyot have a setup entwy point function.

This inhewits fwom ExtensionError

exception disnake.ext.commands.ExtensionFailed(name, original)[source]

A-An exception waised when an extension faiwed to woad d-d-duwing execution of the moduwe ow setup entwy point.

This inhewits fwom ExtensionError

name

The extension that had the ewwow.

Type:

str

original

The owiginyaw exception that was waised. You can awso get this via the __cause__ attwibute.

Type:

Exception

exception disnake.ext.commands.ExtensionNotFound(name)[source]

An exception waised when an extension is nyot found.

This inhewits fwom ExtensionError

Changed in vewsion 1.3: Made the original attwibute awways Nyonye.

name

The e-extension that had the ewwow.

Type:

str

exception disnake.ext.commands.CommandRegistrationError(name, *, alias_conflict=False)[source]

An exception waised when the command can’t be added because the nyame is awweady taken b-b-by a diffewent c-c-command.

This inhewits fwom disnake.ClientException

Nyew in v-v-vewsion 1.4.

name

The c-c-command nyame that had the ewwow.

Type:

str

alias_conflict

Whethew the nyame that confwicts is an awias o-o-of the command we twy to add.

Type:

bool

Exception Hiewawchy

Wawnyings

class disnake.ext.commands.MessageContentPrefixWarning[source]

Wawnying fow invawid pwefixes without message content.

Wawnying Hiewawchy