Pular para conteúdo

Erros

bostie.errors

BostieError

Bases: Exception

Base of errors about Discord, the network and the bot's state.

A bad argument raises ValueError or TypeError instead.

StateError

Bases: BostieError, RuntimeError

The object is not in a state that allows the call.

MissingIntent

Bases: BostieError, ValueError

A feature needs an intent the bot did not ask for.

MemberRequestRateLimited

MemberRequestRateLimited(retry_after: float)

Bases: BostieError

Discord refused a member request; send another after retry_after seconds.

retry_after instance-attribute

retry_after = retry_after

StartupError

Bases: BostieError, OSError

bostie could not set up a system resource it needs.

TransportError

Bases: BostieError

A request failed before Discord answered it.

InvalidToken

Bases: BostieError

Discord rejected the bot token.

RequestBudgetExhausted

Bases: BostieError

bostie refused a request because too many recent requests were invalid.

HTTPException

HTTPException(status: int, code: int, message: str, errors: dict[str, Any], body: bytes)

Bases: BostieError

A request ended with an error status; its text lists each field's errors.

status instance-attribute

status = status

code instance-attribute

code = JSONErrorCode(code)

message instance-attribute

message = message

errors instance-attribute

errors = errors

body instance-attribute

body = body

BadRequest

BadRequest(status: int, code: int, message: str, errors: dict[str, Any], body: bytes)

Bases: HTTPException

Discord answered 400 Bad Request.

status instance-attribute

status = status

code instance-attribute

code = JSONErrorCode(code)

message instance-attribute

message = message

errors instance-attribute

errors = errors

body instance-attribute

body = body

Forbidden

Forbidden(status: int, code: int, message: str, errors: dict[str, Any], body: bytes)

Bases: HTTPException

Discord answered 403 Forbidden.

status instance-attribute

status = status

code instance-attribute

code = JSONErrorCode(code)

message instance-attribute

message = message

errors instance-attribute

errors = errors

body instance-attribute

body = body

NotFound

NotFound(status: int, code: int, message: str, errors: dict[str, Any], body: bytes)

Bases: HTTPException

Discord answered 404 Not Found.

status instance-attribute

status = status

code instance-attribute

code = JSONErrorCode(code)

message instance-attribute

message = message

errors instance-attribute

errors = errors

body instance-attribute

body = body

RateLimited

RateLimited(status: int, code: int, message: str, errors: dict[str, Any], body: bytes, *, retry_after: float | None, is_global: bool)

Bases: HTTPException

Discord answered 429, or bostie held the request back unsent.

bostie holds it back when the route stays limited for longer than it waits.

retry_after instance-attribute

retry_after = retry_after

is_global instance-attribute

is_global = is_global

status instance-attribute

status = status

code instance-attribute

code = JSONErrorCode(code)

message instance-attribute

message = message

errors instance-attribute

errors = errors

body instance-attribute

body = body

ServerError

ServerError(status: int, code: int, message: str, errors: dict[str, Any], body: bytes)

Bases: HTTPException

Discord answered with a 5xx status.

status instance-attribute

status = status

code instance-attribute

code = JSONErrorCode(code)

message instance-attribute

message = message

errors instance-attribute

errors = errors

body instance-attribute

body = body

UnexpectedResponse

UnexpectedResponse(raw_json: bytes, detail: str, *, took_effect: bool)

Bases: BostieError

Discord accepted a request, but its answer does not decode; see raw.

raw_json instance-attribute

raw_json = raw_json

raw property

raw: Any

Discord's answer as JSON, or None if it was empty.

GatewayClosed

GatewayClosed(code: int | None, reason: str)

Bases: BostieError

Discord closed the gateway connection and bostie will not reconnect.

code instance-attribute

code = code

reason instance-attribute

reason = reason

PrivilegedIntentsRequired

PrivilegedIntentsRequired(code: int | None, reason: str)

Bases: GatewayClosed

The bot asked for a privileged intent that is not enabled for it.

code instance-attribute

code = code

reason instance-attribute

reason = reason

ShardingRequired

ShardingRequired(code: int | None, reason: str)

Bases: GatewayClosed

The bot is in too many guilds to run on a single shard.

code instance-attribute

code = code

reason instance-attribute

reason = reason

ShardNotRunning

Bases: StateError

The shard does not run in this process, or has stopped.

GatewayQueueFull

Bases: BostieError

The shard has too many gateway commands waiting to be sent.

CommandError

Bases: BostieError

Base class of errors about application commands and interactions.

CommandDefinitionError

Bases: CommandError, TypeError

A command, group or option is defined in a way Discord does not accept.

SyncProblem dataclass

SyncProblem(command: str, option_path: str, discord_message: str)

One field Discord rejected in a sync, with the command and option it is in.

command instance-attribute

command: str

option_path instance-attribute

option_path: str

discord_message instance-attribute

discord_message: str

CommandSyncError

CommandSyncError(problems: Iterable[SyncProblem])

Bases: CommandError

Discord rejected the commands sent during a sync, one line per problem.

problems instance-attribute

problems = tuple(problems)

OptionConversionError

Bases: CommandError

An option value could not be converted to its annotated type.

InteractionResponded

Bases: CommandError

The interaction is not in a state that allows this response.

InteractionNotAnswered

Bases: CommandError

The interaction needs an answer or a defer before this call.

InteractionExpired

Bases: CommandError

The interaction can no longer be answered.

It is over 15 minutes old, or Discord already rejected or forgot its token.

CheckFailure

CheckFailure(message: str = 'You cannot use this.')

Bases: CommandError

A check refused to run a handler; the message is what the user is told.

MissingPermissions

MissingPermissions(missing: Permissions)

Bases: CheckFailure

The user lacks permissions a check asks for.

missing instance-attribute

missing = missing

BotMissingPermissions

BotMissingPermissions(missing: Permissions)

Bases: CheckFailure

The bot lacks permissions a check asks for.

missing instance-attribute

missing = missing

MissingRole

MissingRole(roles: tuple[int | str, ...])

Bases: CheckFailure

The user has none of the roles a check asks for, given by id or name.

roles instance-attribute

roles = roles

NotOwner

NotOwner()

Bases: CheckFailure

The user is not one of the bot's owners.

CooldownActive

CooldownActive(retry_after: float)

Bases: CheckFailure

A cooldown refused the use; the next one may come after retry_after seconds.

retry_after instance-attribute

retry_after = retry_after

MaxConcurrencyReached

MaxConcurrencyReached(number: int)

Bases: CheckFailure

As many runs as a max_concurrency check allows are already going on.

number instance-attribute

number = number

VoiceError

Bases: BostieError

Base class of voice errors.

VoiceConnectError

VoiceConnectError(reason: DisconnectReason, code: int | None, detail: str)

Bases: VoiceError

A voice connection ended before it was ready.

reason instance-attribute

reason = reason

code instance-attribute

code = code

detail instance-attribute

detail = detail

NotInVoice

Bases: VoiceError

The user is not in a voice channel of this guild.

VoiceNotConnected

Bases: VoiceError

The voice connection has ended.

AlreadyConnected

Bases: VoiceError, StateError

bostie already runs a voice connection in this guild.

VoiceQueueFull

Bases: VoiceError

The voice connection has too many commands waiting.

DaveError

Bases: VoiceError

A DAVE end-to-end encryption step failed.

SinkClosed

Bases: VoiceError

The sink is closed.

BufferFull

Bases: VoiceError

The sink has no room for this write.

Empty

Bases: VoiceError

Nothing is queued in the receiver.

ReceiverClosed

Bases: VoiceError

The receiver ended and has nothing left to read.

SourceError

SourceError(source: str, detail: str)

Bases: VoiceError

A source failed to open, decode or seek.

source instance-attribute

source = source

detail instance-attribute

detail = detail