Object (Gateway events)

discord_http.gateway.object module

class discord_http.gateway.object.AutomodExecution(*, state, guild, channel, user, data)

Bases: object

Represents an automod execution event.

Parameters:
action: AutoModRuleAction

The action that was taken by the automod rule.

rule_id: int

The ID of the automod rule that was triggered.

rule_trigger_type: AutoModRuleTriggerType

The trigger type of the automod rule that was triggered.

guild: Guild | PartialGuild

The guild the automod execution was triggered in.

channel: PartialChannel | None

The channel the automod execution was triggered in, if applicable.

user: Member | PartialMember

The user that triggered the automod execution.

message_id: int | None

The ID of the message that triggered the automod execution, if applicable.

alert_system_message_id: int | None

The ID of the system message that was sent as an alert for the automod execution, if applicable.

content: str | None

The content that triggered the automod execution, if applicable.

matched_keyword: str | None

The keyword that triggered the automod execution, if applicable.

matched_content: str | None

The content that matched the keyword and triggered the automod execution, if applicable.

property rule: PartialAutoModRule

Returns a partial object of automod rule.

rejection_reason
class discord_http.gateway.object.BulkDeletePayload(*, state, data, guild, channel)

Bases: object

Represents a bulk delete event.

Parameters:
guild: Guild | PartialGuild

The guild the messages were deleted in.

channel: BaseChannel | PartialChannel

The channel the messages were deleted in.

messages: list[PartialMessage]

The messages that were deleted.

class discord_http.gateway.object.ChannelPinsUpdate(channel, last_pin_timestamp, guild)

Bases: object

Represents a channel pins update event.

Parameters:
channel: BaseChannel | PartialChannel

The channel the pins were updated in.

guild: PartialGuild | Guild | None

The guild the channel is in. If the channel is a DM channel, this will be None.

last_pin_timestamp: datetime | None

The last time a pin was updated in the channel.

class discord_http.gateway.object.GuildJoinRequest(*, state, guild, data)

Bases: object

Represents a guild join request event.

Parameters:
status: str

The status of the join request. Can be “pending”, “accepted”, or “rejected”.

rejection_reason: str | None

The reason the join request was rejected, if applicable.

user: User | None

The user that made the join request, or None if the user is not available.

user_id: int | None

The ID of the user that made the join request, if available.

guild: Guild | PartialGuild

The guild the join request was made to.

last_seen: datetime | None

The last time the user was seen in the guild, if applicable.

class discord_http.gateway.object.PlayingStatus(*, name=None, status=None, type=None, url=None)

Bases: object

Represents the playing status of the bot.

Parameters:
name

The name of the activity, if any.

status: StatusType | str | int | None

The status of the activity, if any.

type: ActivityType | str | int | None

The type of the activity, if any.

url

The url of the activity, if any. Only applicable for streaming activities.

since: int | None

The timestamp of when the activity started, if applicable.

to_dict() dict

The playing status as a dictionary.

Return type:

dict

class discord_http.gateway.object.PollVoteEvent(*, state, user, channel, guild, type, data)

Bases: object

Represents a poll vote event.

Parameters:
user: Member | PartialMember | PartialUser

The user that made the vote.

guild: PartialGuild | None

The guild the poll is in. If the poll is in a DM channel, this will be None.

channel: PartialChannel

The channel the poll is in.

message: PartialMessage

The message the poll is in.

type: PollVoteActionType

The type of the poll vote action, either “vote” or “unvote”.

answer_id: int

The ID of the answer that was voted or unvoted.

class discord_http.gateway.object.Presence(*, state, user, guild, data)

Bases: object

Represents a presence update event.

Parameters:
user

The user the presence update is for.

guild

The guild the presence update is for.

status: StatusType

The status of the presence update.

activities: list[Activity]

The activities of the presence update.

desktop: StatusType | None

The desktop status of the presence update, if applicable.

mobile: StatusType | None

The mobile status of the presence update, if applicable.

web: StatusType | None

The web status of the presence update, if applicable.

type
class discord_http.gateway.object.Reaction(*, state, data)

Bases: object

Represents a reaction event.

Parameters:
user_id: int

The ID of the user that made the reaction.

id
channel_id: int

The ID of the channel the reaction was made in.

message_id: int

The ID of the message the reaction was made to.

guild_id: int | None

The ID of the guild the reaction was made in, or None if the reaction was made in a DM channel.

message_author_id: int | None

The ID of the user that authored the message the reaction was made to, or None if the message author is not available.

member: Member | None

The member that made the reaction, or None if the member is not available.

emoji: EmojiParser

The emoji that was reacted with.

burst: bool

Whether the reaction is a burst reaction.

burst_colour: Colour | None

The colour of the burst reaction, if applicable.

type: ReactionType

The type of the reaction.

property guild: Guild | PartialGuild | None

The guild the message was sent in.

property channel: PartialChannel | None

Returns the channel the message was sent in.

If guild and channel cache is enabled, it can also return full channel object.

property message: PartialMessage | None

Returns the message if a message_id is available.

class discord_http.gateway.object.ThreadListSyncPayload(*, state, data)

Bases: object

Represents a thread list sync payload.

Parameters:
guild_id: int

The guild ID the thread list sync is for.

channel_ids: list[int]

The parent channel IDs whose threads are being synced. If this is empty, it means all threads in the guild are being synced. This may contains ids of channels that have no active threads.

property guild: PartialGuild

The guild the thread is in.

property threads: list[Thread]

The threads in the thread list.

property members: list[PartialThreadMember]

The members in the thread list.

property channels: list[PartialChannel]

The channels in the thread list.

combined() Iterator[tuple[PartialChannel, tuple[Thread, list[PartialThreadMember]]]]

Returns a combined iterator of channels and threads.

Return type:

Iterator[tuple[PartialChannel, tuple[Thread, list[PartialThreadMember]]]]

class discord_http.gateway.object.ThreadMembersUpdatePayload(*, state, data)

Bases: object

Represents a thread members update’s payload.

Parameters:
id: int

The ID of the thread.

guild_id: int

The guild ID the thread is in.

member_count: int

The total number of members in the thread, capped at 50.

removed_member_ids: list[int]

The IDs of the members that were removed from the thread.

property guild: PartialGuild

The guild the thread is in.

property thread: PartialChannel | Thread

The thread the members were updated in.

property added_members: list[ThreadMember]

The members that were added to the thread.

Type:

list[PartialThreadMember]

property removed_members: list[PartialMember]

The members that were removed from the thread.

Type:

list[PartialMember]

class discord_http.gateway.object.TypingStartEvent(*, guild, channel, user, timestamp)

Bases: object

Represents a typing start event.

Parameters:
guild: PartialGuild | Guild | None

The guild the typing event was triggered in. If the channel is a DM channel, this will be None.

channel: BaseChannel | PartialChannel

The channel the typing event was triggered in.

user: PartialUser | User | Member | PartialMember

The user that started typing.

timestamp: datetime

The time the user started typing.