Errors

discord_http.errors module

exception discord_http.errors.AutomodBlock(r)

Bases: HTTPException

Raised whenever a HTTP request was blocked by Discord.

Parameters:

r (HTTPResponse)

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

request

The HTTP request that caused the exception.

status: int

The HTTP status code.

code: int

The error code returned by Discord, if any.

text: str

The error message returned by Discord, if any.

exception discord_http.errors.BotMissingPermissions(perms)

Bases: CheckFailed

Raised whenever a bot is missing permissions.

Parameters:

perms (Permissions)

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception discord_http.errors.CheckFailed

Bases: DiscordException

Raised whenever a check fails.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception discord_http.errors.CommandError

Bases: Exception

Raised whenever a command error occurs.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception discord_http.errors.CommandOnCooldown(cooldown, retry_after)

Bases: CheckFailed

Raised whenever a command is on cooldown.

Parameters:
cooldown: Cooldown

The cooldown that was triggered.

retry_after: float

The time in seconds until the cooldown expires.

retry_after_ts: float

The timestamp when the cooldown expires.

discord_format: str

The Discord timestamp format for the retry after time.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception discord_http.errors.DiscordException

Bases: Exception

Base exception for discord_http.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception discord_http.errors.DiscordServerError(r)

Bases: HTTPException

Raised whenever an unexpected HTTP error occurs.

Parameters:

r (HTTPResponse)

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

status: int

The HTTP status code.

code: int

The error code returned by Discord, if any.

text: str

The error message returned by Discord, if any.

request

The HTTP request that caused the exception.

exception discord_http.errors.Forbidden(r)

Bases: HTTPException

Raised whenever a HTTP request returns 403.

Parameters:

r (HTTPResponse)

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

status: int

The HTTP status code.

code: int

The error code returned by Discord, if any.

text: str

The error message returned by Discord, if any.

request

The HTTP request that caused the exception.

exception discord_http.errors.HTTPException(r)

Bases: DiscordException

Base exception for HTTP requests.

Parameters:

r (HTTPResponse)

request

The HTTP request that caused the exception.

status: int

The HTTP status code.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

text: str

The error message returned by Discord, if any.

code: int

The error code returned by Discord, if any.

exception discord_http.errors.InvalidMember

Bases: CheckFailed

Raised whenever a user was found, but not a member of a guild.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception discord_http.errors.NotFound(r)

Bases: HTTPException

Raised whenever a HTTP request returns 404.

Parameters:

r (HTTPResponse)

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

status: int

The HTTP status code.

code: int

The error code returned by Discord, if any.

text: str

The error message returned by Discord, if any.

request

The HTTP request that caused the exception.

exception discord_http.errors.Ratelimited(r)

Bases: HTTPException

Raised whenever a HTTP request returns 429, but without a Retry-After header.

Parameters:

r (HTTPResponse)

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

status: int

The HTTP status code.

code: int

The error code returned by Discord, if any.

text: str

The error message returned by Discord, if any.

request

The HTTP request that caused the exception.

exception discord_http.errors.UserMissingPermissions(perms)

Bases: CheckFailed

Raised whenever a user is missing permissions.

Parameters:

perms (Permissions)

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.