Gateway-specific Event Models#

class interactions.api.models.gw.AutoModerationAction(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.3.0.

A class object representing the gateway event AUTO_MODERATION_ACTION_EXECUTION.

Variables:
  • guild_id (Snowflake) – The ID of the guild in which the action was executed.

  • action (AutoModAction) – The action which was executed.

  • rule_id (Snowflake) – The rule ID that the action belongs to.

  • rule_trigger_type (int) – The trigger rule type.

  • channel_id (Optional[Snowflake]) – The id of the channel in which user content was posted.

  • message_id (Optional[Snowflake]) – The id of any user message which content belongs to.

  • alert_system_message_id (Optional[Snowflake]) – The id of any system automoderation messages posted as a result of this action.

  • content (str) – The user-generated text content in question.

  • matched_keyword (Optional[str]) – The word/phrase configured in rule that triggered rule.

  • matched_content (Optional[str]) – The substring in content that triggered rule.

class interactions.api.models.gw.AutoModerationRule(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.3.0.

A class object representing the gateway events AUTO_MODERATION_RULE_CREATE, AUTO_MODERATION_RULE_UPDATE, and AUTO_MODERATION_RULE_DELETE

Note

event_type at the moment can only be 1, which represents message sending.

Variables:
  • id (Snowflake) – The ID of the rule.

  • guild_id (Snowflake) – The guild ID associated with the rule.

  • name (str) – The rule name.

  • creator_id (Snowflake) – The user ID that first created this rule.

  • event_type (int) – The rule type in which automod checks.

  • trigger_type (AutoModTriggerType) – The automod type. It characterises what type of information that is checked.

  • trigger_metadata (AutoModTriggerMetadata) – Additional data needed to figure out whether this rule should be triggered.

  • actions (List[AutoModerationAction]) – The actions that will be executed when the rule is triggered.

  • enabled (bool) – Whether the rule is enabled.

  • exempt_roles (List[Snowflake]) – The role IDs that should not be affected by this rule. (Max 20)

  • exempt_channels (List[Snowflake]) – The channel IDs that should not be affected by this rule. (Max 20)

class interactions.api.models.gw.ApplicationCommandPermission(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the permission of an application command.

The structure for a permission:

interactions.ApplicationCommandPermission(
    id=1234567890,
    type=interactions.PermissionType.USER,
    permission=True,
)
Variables:
  • id (int) – The ID of the permission.

  • type (PermissionType) – The type of permission.

  • permission (bool) – The permission state. True for allow, False for disallow.

class interactions.api.models.gw.ApplicationCommandPermissions(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.1.0.

A class object representing the gateway event APPLICATION_COMMAND_PERMISSIONS_UPDATE.

Variables:
  • id (Snowflake) – ID of the command or the application ID

  • application_id (Snowflake) – ID of the application the command belongs to

  • guild_id (Snowflake) – ID of the guild

  • permissions (List[ApplicationCommandPermission]) – Permissions for the command in the guild, max of 100

class interactions.api.models.gw.EmbeddedActivity(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.0.2.

A class object representing the event EMBEDDED_ACTIVITY_UPDATE.

Note

This is entirely undocumented by the API.

Variables:
  • users (List[Snowflake]) – The list of users of the event.

  • guild_id (Snowflake) – The guild ID of the event.

  • embedded_activity (PresenceActivity) – The embedded presence activity of the associated event.

  • channel_id (Snowflake) – The channel ID of the event.

class interactions.api.models.gw.Integration(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway events INTEGRATION_CREATE, INTEGRATION_UPDATE and INTEGRATION_DELETE.

Note

The documentation of this event is the same as Guild.

Variables:
  • id (Snowflake) – The ID of the event.

  • name (str) – The name of the event.

  • type (str) – The type of integration in the event.

  • enabled (bool) – Whether the integration of the event is enabled or not.

  • syncing (bool) – Whether the integration of the event is syncing or not.

  • role_id (Snowflake) – The role ID that the integration in the event uses for “subscribed” users.

  • enable_emoticons (bool) – Whether emoticons of the integration’s event should be enabled or not.

  • expire_behavior (int) – The expiration behavior of the integration of the event.

  • expire_grace_period (int) – The “grace period” of the integration of the event when expired – how long it can still be used.

  • user (User) – The user of the event.

  • account (Any) – The account of the event.

  • synced_at (datetime) – The time that the integration of the event was last synced.

  • subscriber_count (int) – The current subscriber count of the event.

  • revoked (bool) – Whether the integration of the event was revoked for use or not.

  • application (Application) – The application used for the integration of the event.

  • guild_id (Snowflake) – The guild ID of the event.

class interactions.api.models.gw.ChannelPins(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event CHANNEL_PINS_UPDATE.

Variables:
  • guild_id (Snowflake) – The guild ID of the event.

  • channel_id (Snowflake) – The channel ID of the event.

  • last_pin_timestamp (datetime) – The time that the event took place.

class interactions.api.models.gw.ThreadMembers(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event THREAD_MEMBERS_UPDATE.

Variables:
  • id (Snowflake) – The ID of the event.

  • guild_id (Snowflake) – The guild ID of the event.

  • member_count (int) – The member count of the event.

  • added_members (Optional[List[ThreadMember]]) – The added members of the thread of the event.

  • removed_member_ids (Optional[List[Snowflake]]) – The removed IDs of members of the thread of the event.

class interactions.api.models.gw.ThreadList(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event THREAD_LIST_SYNC.

Variables:
  • guild_id (Snowflake) – The guild ID of the event.

  • channel_ids (Optional[List[Snowflake]]) – The channel IDs of the event.

  • threads (List[Channel]) – The threads of the event.

  • members (List[ThreadMember]) – The members of the thread of the event.

class interactions.api.models.gw.MessageDelete(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.3.1.

A class object representing the gateway event MESSAGE_DELETE_BULK.

Variables:
  • ids (List[Snowflake]) – The message IDs of the event.

  • channel_id (Snowflake) – The channel ID of the event.

  • guild_id (Optional[Snowflake]) – The guild ID of the event.

class interactions.api.models.gw.MessageReactionRemove(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway events MESSAGE_REACTION_REMOVE_ALL and MESSAGE_REACTION_REMOVE_EMOJI.

Note

This class inherits the already existing attributes of MessageReaction. The main missing attribute is member.

Variables:
  • user_id (Optional[Snowflake]) – The user ID of the event.

  • channel_id (Snowflake) – The channel ID of the event.

  • message_id (Snowflake) – The message ID of the event.

  • guild_id (Optional[Snowflake]) – The guild ID of the event.

  • emoji (Optional[Emoji]) – The emoji of the event.

class interactions.api.models.gw.MessageReaction(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event MESSAGE_REACTION_ADD and MESSAGE_REACTION_REMOVE.

Variables:
  • user_id (Optional[Snowflake]) – The user ID of the event.

  • channel_id (Snowflake) – The channel ID of the event.

  • message_id (Snowflake) – The message ID of the event.

  • guild_id (Optional[Snowflake]) – The guild ID of the event.

  • member (Optional[Member]) – The member of the event.

  • emoji (Optional[Emoji]) – The emoji of the event.

class interactions.api.models.gw.GuildIntegrations(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event GUILD_INTEGRATIONS_UPDATE.

Variables:

guild_id (Snowflake) – The guild ID of the event.

class interactions.api.models.gw.GuildBan(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event GUILD_BAN_ADD.

Variables:
  • guild_id (Snowflake) – The guild ID of the event.

  • user (User) – The user of the event.

class interactions.api.models.gw.Webhooks(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.1.0.

A class object representing the gateway event WEBHOOKS_UPDATE.

Variables:
  • channel_id (Snowflake) – The channel ID of the associated event.

  • guild_id (Snowflake) – The guild ID of the associated event.

class interactions.api.models.gw.GuildMembers(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event GUILD_MEMBERS_CHUNK.

Variables:
  • guild_id (Snowflake) – The guild ID of the event.

  • members (List[Member]) – The members of the event.

  • chunk_index (int) – The current chunk index of the event.

  • chunk_count (int) – The total chunk count of the event.

  • not_found (list) – A list of not found members in the event if an invalid request was made.

  • presences (List[PresenceActivity]) – A list of presences in the event.

  • nonce (str) – The “nonce” of the event.

class interactions.api.models.gw.GuildMember(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway events GUILD_MEMBER_ADD, GUILD_MEMBER_UPDATE and GUILD_MEMBER_REMOVE.

Changed in version 4.3.2: GuildMember now subclasses Member.

Note

pending and permissions only apply for members retroactively requiring to verify rules via. membership screening or lack permissions to speak.

Variables:
  • guild_id (Snowflake) – The guild ID.

  • user (User) – The user of the guild.

  • nick (str) – The nickname of the member.

  • avatar (Optional[str]) – The hash containing the user’s guild avatar, if applicable.

  • roles (List[int]) – The list of roles of the member.

  • joined_at (datetime) – The timestamp the member joined the guild at.

  • premium_since (datetime) – The timestamp the member has been a server booster since.

  • deaf (bool) – Whether the member is deafened.

  • mute (bool) – Whether the member is muted.

  • pending (Optional[bool]) – Whether the member is pending to pass membership screening.

  • permissions (Optional[Permissions]) – Whether the member has permissions.

  • communication_disabled_until (Optional[str]) – How long until they’re unmuted, if any.

class interactions.api.models.gw.GuildStickers(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event GUILD_STICKERS_UPDATE.

Variables:
  • guild_id (Snowflake) – The guild ID of the event.

  • stickers (List[Sticker]) – The stickers of the event.

class interactions.api.models.gw.GuildScheduledEventUser(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.3.0.

A class object representing the gateway events GUILD_SCHEDULED_EVENT_USER_ADD and GUILD_SCHEDULED_EVENT_USER_REMOVE

Variables:
  • guild_scheduled_event_id (Snowflake) – The ID of the guild scheduled event.

  • guild_id (Snowflake) – The ID of the guild associated with this event.

  • user_id (Snowflake) – The ID of the user associated with this event.

class interactions.api.models.gw.GuildScheduledEvent(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.3.0.

A class object representing gateway events GUILD_SCHEDULED_EVENT_CREATE, GUILD_SCHEDULED_EVENT_UPDATE, GUILD_SCHEDULED_EVENT_DELETE.

Note

Some attributes are optional via creator_id/creator implementation by the API: “creator_id will be null and creator will not be included for events created before October 25th, 2021, when the concept of creator_id was introduced and tracked.”

Variables:
  • id (Snowflake) – The ID of the scheduled event.

  • guild_id (Snowflake) – The ID of the guild that this scheduled event belongs to.

  • channel_id (Optional[Snowflake]) – The channel ID in which the scheduled event belongs to, if any.

  • creator_id (Optional[Snowflake]) – The ID of the user that created the scheduled event.

  • name (str) – The name of the scheduled event.

  • description (str) – The description of the scheduled event.

  • scheduled_start_time (datetime) – The scheduled event start time.

  • scheduled_end_time (Optional[datetime]) – The scheduled event end time, if any.

  • privacy_level (int) – The privacy level of the scheduled event.

  • entity_type (int) – The type of the scheduled event.

  • entity_id (Optional[Snowflake]) – The ID of the entity associated with the scheduled event.

  • entity_metadata (Optional[EventMetadata]) – Additional metadata associated with the scheduled event.

  • creator (Optional[User]) – The user that created the scheduled event.

  • user_count (Optional[int]) – The number of users subscribed to the scheduled event.

  • status (int) – The status of the scheduled event

  • image (Optional[str]) – The hash containing the image of an event, if applicable.

class interactions.api.models.gw.Presence(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event PRESENCE_UPDATE.

Variables:
  • user (User) – The user of the event.

  • guild_id (Snowflake) – The guild ID of the event.

  • status (str) – The status of the event.

  • activities (List[PresenceActivity]) – The activities of the event.

  • client_status (ClientStatus) – The client status across platforms in the event.

class interactions.api.models.gw.GuildJoinRequest(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.0.2.

A class object representing the gateway events GUILD_JOIN_REQUEST_CREATE, GUILD_JOIN_REQUEST_UPDATE, and GUILD_JOIN_REQUEST_DELETE

Note

This is entirely undocumented by the API.

Variables:
  • user_id (Snowflake) – The user ID of the event.

  • guild_id (Snowflake) – The guild ID of the event.

  • request (Optional[Any]) – The actual request representing the event. This pertains primarily to _CREATE, but maybe _UPDATE as well.

  • status (Optional[str]) – The status of the event, which pertains to _CREATE.

class interactions.api.models.gw.GuildEmojis(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway event GUILD_EMOJIS_UPDATE.

Variables:
  • guild_id (Snowflake) – The guild ID of the event.

  • emojis (List[Emoji]) – The emojis of the event.

class interactions.api.models.gw.GuildRole(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing the gateway events GUILD_ROLE_CREATE, GUILD_ROLE_UPDATE and GUILD_ROLE_DELETE.

Variables:
  • guild_id (Snowflake) – The guild ID of the event.

  • role (Optional[Role]) – The role of the event.

  • role_id (Optional[Snowflake]) – The role ID of the event.

class interactions.api.models.gw.VoiceState(kwargs_dict=None, /, **other_kwargs)[source]#

New in version 4.4.0.

A class object representing the gateway event VOICE_STATE_UPDATE. This class creates an object every time the event VOICE_STATE_UPDATE is received from the discord API. It contains information about the user’s update voice information. Additionally, the last voice state is cached, allowing you to see, what attributes of the user’s voice information change.

Variables:
  • member (Member) – The member whose VoiceState was updated

  • user_id (Snowflake) – The id of the user whose VoiceState was updated. This is technically the same as the “member id”, but it is called user_id because of API terminology.

  • suppress (bool) – Whether the user is muted by the current user(-> bot)

  • session_id (int) – The id of the session

  • self_video (bool) – Whether the user’s camera is enabled.

  • self_mute (bool) – Whether the user is muted by themselves

  • self_deaf (bool) – Whether the user is deafened by themselves

  • self_stream (bool) – Whether the user is streaming in the current channel

  • request_to_speak_timestamp (datetime) – Only for stage-channels; when the user requested permissions to speak in the stage channel

  • mute (bool) – Whether the user’s microphone is muted by the server

  • guild_id (Snowflake) – The id of the guild in what the update took action

  • deaf (bool) – Whether the user is deafened by the guild

  • channel_id (Snowflake) – The id of the channel the update took action

property joined: bool#

Whether the user joined the channel.

Return type:

bool

async mute_member(reason=None)[source]#

Mutes the current member.

Parameters:

reason (Optional[str]) – The reason of the muting, optional

Returns:

The modified member object

Return type:

Member

async deafen_member(reason=None)[source]#

Deafens the current member.

Parameters:

reason (Optional[str]) – The reason of the deafening, optional

Returns:

The modified member object

Return type:

Member

async move_member(channel_id, *, reason=None)[source]#

Moves the member to another channel.

Parameters:
  • channel_id (Union[int, str, Snowflake]) – The ID of the channel to move the user to

  • reason (Optional[str]) – The reason of the move

Returns:

The modified member object

Return type:

Member

async get_channel()[source]#

Gets the channel in what the update took place.

Return type:

Channel

async get_guild()[source]#

Gets the guild in what the update took place.

Return type:

Guild