Exceptions and Warnings¶
This section documents exceptions and warnings specific to commands extension.
Exceptions¶
- exception disnake.ext.commands.CommandError(message=None, *args)[source]¶
- The base exception type for all command related errors. - This inherits from - disnake.DiscordException.- This exception and exceptions inherited from it are handled in a special way as they are caught and passed into a special event from - Bot,- on_command_error().
- exception disnake.ext.commands.ConversionError(converter, original)[source]¶
- Exception raised when a Converter class raises non-CommandError. - This inherits from - CommandError.
- exception disnake.ext.commands.MissingRequiredArgument(param)[source]¶
- Exception raised when parsing a command and a parameter that is required is not encountered. - This inherits from - UserInputError- param¶
- The argument that is missing. - Type:
 
 
- exception disnake.ext.commands.ArgumentParsingError(message=None, *args)[source]¶
- An exception raised when the parser fails to parse a user’s input. - This inherits from - UserInputError.- There are child classes that implement more granular parsing errors for i18n purposes. 
- exception disnake.ext.commands.UnexpectedQuoteError(quote)[source]¶
- An exception raised when the parser encounters a quote mark inside a non-quoted string. - This inherits from - ArgumentParsingError.
- exception disnake.ext.commands.InvalidEndOfQuotedStringError(char)[source]¶
- An exception raised when a space is expected after the closing quote in a string but a different character is found. - This inherits from - ArgumentParsingError.
- exception disnake.ext.commands.ExpectedClosingQuoteError(close_quote)[source]¶
- An exception raised when a quote character is expected but not found. - This inherits from - ArgumentParsingError.
- exception disnake.ext.commands.BadArgument(message=None, *args)[source]¶
- Exception raised when a parsing or conversion failure is encountered on an argument to pass into a command. - This inherits from - UserInputError
- exception disnake.ext.commands.BadUnionArgument(param, converters, errors)[source]¶
- Exception raised when a - typing.Unionconverter fails for all its associated types.- This inherits from - UserInputError- param¶
- The parameter that failed being converted. - Type:
 
 - converters¶
- A tuple of converters attempted in conversion, in order of failure. - Type:
- Tuple[Type, - ...]
 
 - errors¶
- A list of errors that were caught from failing the conversion. - Type:
- List[ - CommandError]
 
 
- exception disnake.ext.commands.BadLiteralArgument(param, literals, errors)[source]¶
- Exception raised when a - typing.Literalconverter fails for all its associated values.- This inherits from - UserInputError- New in version 2.0. - param¶
- The parameter that failed being converted. - Type:
 
 - literals¶
- A tuple of values compared against in conversion, in order of failure. - Type:
- Tuple[Any, - ...]
 
 - errors¶
- A list of errors that were caught from failing the conversion. - Type:
- List[ - CommandError]
 
 
- exception disnake.ext.commands.PrivateMessageOnly(message=None)[source]¶
- Exception raised when an operation does not work outside of private message contexts. - This inherits from - CheckFailure
- exception disnake.ext.commands.NoPrivateMessage(message=None)[source]¶
- Exception raised when an operation does not work in private message contexts. - This inherits from - CheckFailure
- exception disnake.ext.commands.CheckFailure(message=None, *args)[source]¶
- Exception raised when the predicates in - Command.checksor- InvokableApplicationCommand.checkshave failed.- This inherits from - CommandError
- exception disnake.ext.commands.CheckAnyFailure(checks, errors)[source]¶
- Exception raised when all predicates in - check_any()or- app_check_any()fail.- This inherits from - CheckFailure.- New in version 1.3. - errors¶
- A list of errors that were caught during execution. - Type:
- List[ - CheckFailure]
 
 - checks¶
- A list of check predicates that failed. - Type:
- List[Callable[[Union[ - Context,- disnake.ApplicationCommandInteraction]],- bool]]
 
 
- exception disnake.ext.commands.CommandNotFound(message=None, *args)[source]¶
- Exception raised when a command is attempted to be invoked but no command under that name is found. - This is not raised for invalid subcommands, rather just the initial main command that is attempted to be invoked. - This inherits from - CommandError.
- exception disnake.ext.commands.DisabledCommand(message=None, *args)[source]¶
- Exception raised when the command being invoked is disabled. - This inherits from - CommandError
- exception disnake.ext.commands.CommandInvokeError(e)[source]¶
- Exception raised when the command being invoked raised an exception. - This inherits from - CommandError
- exception disnake.ext.commands.TooManyArguments(message=None, *args)[source]¶
- Exception raised when the command was passed too many arguments and its - Command.ignore_extraattribute was not set to- True.- This inherits from - UserInputError
- exception disnake.ext.commands.UserInputError(message=None, *args)[source]¶
- The base exception type for errors that involve errors regarding user input. - This inherits from - CommandError.
- exception disnake.ext.commands.CommandOnCooldown(cooldown, retry_after, type)[source]¶
- Exception raised when the command being invoked is on cooldown. - This inherits from - CommandError- cooldown¶
- A class with attributes - rateand- persimilar to the- cooldown()decorator.- Type:
 
 - type¶
- The type associated with the cooldown. - Type:
 
 
- exception disnake.ext.commands.MaxConcurrencyReached(number, per)[source]¶
- Exception raised when the command being invoked has reached its maximum concurrency. - This inherits from - CommandError.- per¶
- The bucket type passed to the - max_concurrency()decorator.- Type:
 
 
- exception disnake.ext.commands.NotOwner(message=None, *args)[source]¶
- Exception raised when the message author is not the owner of the bot. - This inherits from - CheckFailure
- exception disnake.ext.commands.ObjectNotFound(argument)[source]¶
- Exception raised when the argument provided did not match the format of an ID or a mention. - This inherits from - BadArgument- New in version 2.0. 
- exception disnake.ext.commands.MessageNotFound(argument)[source]¶
- Exception raised when the message provided was not found in the channel. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.MemberNotFound(argument)[source]¶
- Exception raised when the member provided was not found in the bot’s cache. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.GuildNotFound(argument)[source]¶
- Exception raised when the guild provided was not found in the bot’s cache. - This inherits from - BadArgument- New in version 1.7. 
- exception disnake.ext.commands.UserNotFound(argument)[source]¶
- Exception raised when the user provided was not found in the bot’s cache. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.ChannelNotFound(argument)[source]¶
- Exception raised when the bot can not find the channel. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.ChannelNotReadable(argument)[source]¶
- Exception raised when the bot does not have permission to read messages in the channel. - This inherits from - BadArgument- New in version 1.5. - argument¶
- The channel supplied by the caller that was not readable - Type:
- Union[ - abc.GuildChannel,- Thread]
 
 
- exception disnake.ext.commands.ThreadNotFound(argument)[source]¶
- Exception raised when the bot can not find the thread. - This inherits from - BadArgument- New in version 2.0. 
- exception disnake.ext.commands.BadColourArgument(argument)[source]¶
- Exception raised when the colour is not valid. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.RoleNotFound(argument)[source]¶
- Exception raised when the bot can not find the role. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.BadInviteArgument(argument)[source]¶
- Exception raised when the invite is invalid or expired. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.EmojiNotFound(argument)[source]¶
- Exception raised when the bot can not find the emoji. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.PartialEmojiConversionFailure(argument)[source]¶
- Exception raised when the emoji provided does not match the correct format. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.GuildStickerNotFound(argument)[source]¶
- Exception raised when the bot can not find the sticker. - This inherits from - BadArgument- New in version 2.0. 
- exception disnake.ext.commands.GuildSoundboardSoundNotFound(argument)[source]¶
- Exception raised when the bot can not find the soundboard sound. - This inherits from - BadArgument- New in version 2.10. 
- exception disnake.ext.commands.GuildScheduledEventNotFound(argument)[source]¶
- Exception raised when the bot cannot find the scheduled event. - This inherits from - BadArgument- New in version 2.5. 
- exception disnake.ext.commands.BadBoolArgument(argument)[source]¶
- Exception raised when a boolean argument was not convertible. - This inherits from - BadArgument- New in version 1.5. 
- exception disnake.ext.commands.LargeIntConversionFailure(argument)[source]¶
- Exception raised when a large integer argument was not able to be converted. - This inherits from - BadArgument- New in version 2.5. 
- exception disnake.ext.commands.MissingPermissions(missing_permissions, *args)[source]¶
- Exception raised when the command invoker lacks permissions to run a command. - This inherits from - CheckFailure
- exception disnake.ext.commands.BotMissingPermissions(missing_permissions, *args)[source]¶
- Exception raised when the bot’s member lacks permissions to run a command. - This inherits from - CheckFailure
- exception disnake.ext.commands.MissingRole(missing_role)[source]¶
- Exception raised when the command invoker lacks a role to run a command. - This inherits from - CheckFailure- New in version 1.1. - missing_role¶
- The required role that is missing. This is the parameter passed to - has_role().
 
- exception disnake.ext.commands.BotMissingRole(missing_role)[source]¶
- Exception raised when the bot’s member lacks a role to run a command. - This inherits from - CheckFailure- New in version 1.1. - missing_role¶
- The required role that is missing. This is the parameter passed to - has_role().
 
- exception disnake.ext.commands.MissingAnyRole(missing_roles)[source]¶
- Exception raised when the command invoker lacks any of the roles specified to run a command. - This inherits from - CheckFailure- New in version 1.1. - missing_roles¶
- The roles that the invoker is missing. These are the parameters passed to - has_any_role().
 
- exception disnake.ext.commands.BotMissingAnyRole(missing_roles)[source]¶
- Exception raised when the bot’s member lacks any of the roles specified to run a command. - This inherits from - CheckFailure- New in version 1.1. - missing_roles¶
- The roles that the bot’s member is missing. These are the parameters passed to - has_any_role().
 
- exception disnake.ext.commands.NSFWChannelRequired(channel)[source]¶
- Exception raised when a channel does not have the required NSFW setting. - This inherits from - CheckFailure.- New in version 1.1. - Parameters:
- channel (Union[ - abc.GuildChannel,- Thread]) – The channel that does not have NSFW enabled.
 
- exception disnake.ext.commands.FlagError(message=None, *args)[source]¶
- The base exception type for all flag parsing related errors. - This inherits from - BadArgument.- New in version 2.0. 
- exception disnake.ext.commands.BadFlagArgument(flag)[source]¶
- An exception raised when a flag failed to convert a value. - This inherits from - FlagError- New in version 2.0. 
- exception disnake.ext.commands.MissingFlagArgument(flag)[source]¶
- An exception raised when a flag did not get a value. - This inherits from - FlagError- New in version 2.0. 
- exception disnake.ext.commands.TooManyFlags(flag, values)[source]¶
- An exception raised when a flag has received too many values. - This inherits from - FlagError.- New in version 2.0. 
- exception disnake.ext.commands.MissingRequiredFlag(flag)[source]¶
- An exception raised when a required flag was not given. - This inherits from - FlagError- New in version 2.0. 
- exception disnake.ext.commands.ExtensionError(message=None, *args, name)[source]¶
- Base exception for extension related errors. - This inherits from - DiscordException.
- exception disnake.ext.commands.ExtensionAlreadyLoaded(name)[source]¶
- An exception raised when an extension has already been loaded. - This inherits from - ExtensionError
- exception disnake.ext.commands.ExtensionNotLoaded(name)[source]¶
- An exception raised when an extension was not loaded. - This inherits from - ExtensionError
- exception disnake.ext.commands.NoEntryPointError(name)[source]¶
- An exception raised when an extension does not have a - setupentry point function.- This inherits from - ExtensionError
- exception disnake.ext.commands.ExtensionFailed(name, original)[source]¶
- An exception raised when an extension failed to load during execution of the module or - setupentry point.- This inherits from - ExtensionError
- exception disnake.ext.commands.ExtensionNotFound(name)[source]¶
- An exception raised when an extension is not found. - This inherits from - ExtensionError- Changed in version 1.3: Made the - originalattribute always None.
- exception disnake.ext.commands.CommandRegistrationError(name, *, alias_conflict=False)[source]¶
- An exception raised when the command can’t be added because the name is already taken by a different command. - This inherits from - disnake.ClientException- New in version 1.4. 
Exception Hierarchy¶
Warnings¶
- class disnake.ext.commands.MessageContentPrefixWarning[source]¶
- Warning for invalid prefixes without message content.