Enums

discord_http.gateway.enums module

class discord_http.gateway.enums.ActivityType(value)

Bases: BaseEnum

Represents the type of a gateway presence activity.

playing = 0
streaming = 1
listening = 2
watching = 3
custom = 4
competing = 5
hang = 6
property pretty_name: str

A prettified version of the enum name.

classmethod random() Self

Return a random enum.

Return type:

Self

classmethod try_get(key, default=None) Self | None

Try to get an enum member by name or value, returning a default if not found.

Parameters:
  • key (str | int | None) – The name or value of the enum member to retrieve.

  • default (Optional[Self]) – The value to return if the key is not found.

Return type:

Optional[Self]

Returns:

The enum member if found, otherwise the default value.

classmethod names() list[str]

Return a list of all enum names.

Return type:

list[str]

classmethod values() list[int | str]

Return a list of all enum values.

Return type:

list[int | str]

classmethod to_dict() dict[str, int | str]

Return a dictionary mapping names to values.

Return type:

dict[str, int | str]

class discord_http.gateway.enums.PayloadType(value)

Bases: BaseEnum

Represents the opcode type of a gateway payload.

dispatch = 0
heartbeat = 1
identify = 2
presence = 3
voice_state = 4
voice_ping = 5
resume = 6
reconnect = 7
request_guild_members = 8
invalidate_session = 9
hello = 10
heartbeat_ack = 11
guild_sync = 12
property pretty_name: str

A prettified version of the enum name.

classmethod random() Self

Return a random enum.

Return type:

Self

classmethod try_get(key, default=None) Self | None

Try to get an enum member by name or value, returning a default if not found.

Parameters:
  • key (str | int | None) – The name or value of the enum member to retrieve.

  • default (Optional[Self]) – The value to return if the key is not found.

Return type:

Optional[Self]

Returns:

The enum member if found, otherwise the default value.

classmethod names() list[str]

Return a list of all enum names.

Return type:

list[str]

classmethod values() list[int | str]

Return a list of all enum values.

Return type:

list[int | str]

classmethod to_dict() dict[str, int | str]

Return a dictionary mapping names to values.

Return type:

dict[str, int | str]

class discord_http.gateway.enums.PollVoteActionType(value)

Bases: BaseEnum

Represents whether a poll vote was added or removed.

add = 0
remove = 1
property pretty_name: str

A prettified version of the enum name.

classmethod random() Self

Return a random enum.

Return type:

Self

classmethod try_get(key, default=None) Self | None

Try to get an enum member by name or value, returning a default if not found.

Parameters:
  • key (str | int | None) – The name or value of the enum member to retrieve.

  • default (Optional[Self]) – The value to return if the key is not found.

Return type:

Optional[Self]

Returns:

The enum member if found, otherwise the default value.

classmethod names() list[str]

Return a list of all enum names.

Return type:

list[str]

classmethod values() list[int | str]

Return a list of all enum values.

Return type:

list[int | str]

classmethod to_dict() dict[str, int | str]

Return a dictionary mapping names to values.

Return type:

dict[str, int | str]

class discord_http.gateway.enums.ShardCloseType(value)

Bases: BaseEnum

Represents the close type of a gateway shard.

resume = 0
reconnect = 1
invalid_session = 2
normal_crash = 100
hard_crash = 101
property pretty_name: str

A prettified version of the enum name.

classmethod random() Self

Return a random enum.

Return type:

Self

classmethod try_get(key, default=None) Self | None

Try to get an enum member by name or value, returning a default if not found.

Parameters:
  • key (str | int | None) – The name or value of the enum member to retrieve.

  • default (Optional[Self]) – The value to return if the key is not found.

Return type:

Optional[Self]

Returns:

The enum member if found, otherwise the default value.

classmethod names() list[str]

Return a list of all enum names.

Return type:

list[str]

classmethod values() list[int | str]

Return a list of all enum values.

Return type:

list[int | str]

classmethod to_dict() dict[str, int | str]

Return a dictionary mapping names to values.

Return type:

dict[str, int | str]

class discord_http.gateway.enums.StatusType(value)

Bases: BaseEnum

Represents the online status of a user or bot.

offline = 0
online = 1
idle = 2
dnd = 3
streaming = 4
property pretty_name: str

A prettified version of the enum name.

classmethod random() Self

Return a random enum.

Return type:

Self

classmethod try_get(key, default=None) Self | None

Try to get an enum member by name or value, returning a default if not found.

Parameters:
  • key (str | int | None) – The name or value of the enum member to retrieve.

  • default (Optional[Self]) – The value to return if the key is not found.

Return type:

Optional[Self]

Returns:

The enum member if found, otherwise the default value.

classmethod names() list[str]

Return a list of all enum names.

Return type:

list[str]

classmethod values() list[int | str]

Return a list of all enum values.

Return type:

list[int | str]

classmethod to_dict() dict[str, int | str]

Return a dictionary mapping names to values.

Return type:

dict[str, int | str]