Exceptions

The following sections outline the exceptions that can be generated by using any of the methods in the API.

Exception Hierarchy

Objects

The following exceptions are thrown by the library.

exception discord_tools.MaxUsagesReached(command, limit, *args)[source]

An exception raised when a command has reached its maximum usages.

command

The context that raised the error.

Type:

discord.ext.commands.Command

exception discord_tools.NotInValidGuild(command, guild, *args)[source]

An exception raised when a command has been invoked in a non-allowed guild.

command

The command that raised the error.

Type:

discord.ext.commands.Command

guild

The guild in which this command was invoked in.

Type:

discord.Guild

exception discord_tools.MissingAnyPermissions(missing_permissions, *args)[source]

An exception raised when the command invoker lacks any permissions to run a command.

missing_permissions

The permissions that the invoker is missing.

Type:

List[str]

exception discord_tools.MissingAttachments(count, minimum, *args)[source]

An exception raised when the invoker message does not have enough attachments to run a command.

attachment_count

The amount of attachments the message has.

Type:

int

attachment_minimum

The minimum amount of attachments the message must have.

Type:

int

exception discord_tools.NoVoiceState(author, context, *args)[source]

An exception raised when the command invoker has no voice state (is not connected in a voice channel).

author

The author that did not have a voice state.

Type:

discord.Member

context

The context that failed.

Type:

discord.ext.commands.Context

exception discord_tools.StringDoesNotMatch(converter, argument, *args)[source]

An exception raised when the RegexConverter fails to find an occurrence in a string.

Added in version 1.0.

pattern

The pattern that was searched for.

Type:

re.Pattern

argument

The argument that failed.

Type:

str