Skip to content

Channel Events

Note

The following classes come from the scurrypy.events.channel_events module.


ChannelCreateEvent dataclass

Bases: Event, ChannelModel

Received when a guild channel has been created.

id: int instance-attribute

ID of the channel.

type: int instance-attribute

Type of channel.

guild_id: Optional[int] instance-attribute

Guild ID of the channel.

parent_id: Optional[int] instance-attribute

Category ID of the channel.

position: Optional[int] instance-attribute

Position of the channel.

name: str instance-attribute

Dispatch name of event.

topic: Optional[str] instance-attribute

Topic of the channel.

nsfw: Optional[bool] instance-attribute

If the channel is flagged NSFW.

last_message_id: Optional[int] instance-attribute

ID of the last message sent in the channel.

rate_limit_per_user: Optional[int] instance-attribute

Seconds user must wait between sending messages in the channel.

recipients: Optional[list[UserModel]] instance-attribute

Recipients of the DM.

icon: Optional[str] instance-attribute

Icon hash of the group DM.

owner_id: Optional[int] instance-attribute

ID of the creator of the group DM or thread.

application_id: Optional[int] instance-attribute

ID of the application that created the DM or thread.

last_pin_timestamp: Optional[str] instance-attribute

ISO8601 timestamp of the last pinned messsage in the channel.

permissions: Optional[int] instance-attribute

Permissions for the invoking user in this channel. Includes role and overwrite calculations. [INT_LIMIT]

thread_metadata: Optional[ThreadMetadataModel] instance-attribute

Thread-specific fields not needed by other channels.

member: Optional[ThreadMemberModel] instance-attribute

Thread member object for the current user if they have joined the thread.

default_auto_archive_duration: Optional[int] instance-attribute

Default duration in minutes threads will be hidden after period of inactivity.

flags: Optional[int] instance-attribute

Channel flags combined as a bitfield. See ChannelFlags.

available_tags: Optional[list[TagModel]] instance-attribute

Set of tags that can be applied to a GUILD_FORUM post.

applied_tags: Optional[list[int]] instance-attribute

Set of tags applied to a GUILD_FORUM post.

default_reaction_emoji: Optional[DefaultReactionModel] instance-attribute

Emoji to show in the add reaction button in a GUILD_FORUM post.

default_thread_rate_limit_per_user: Optional[int] instance-attribute

Rate limit per user set on newly created threads.

Note

This field does not live update!

default_sort_order: Optional[int] instance-attribute

Default forum sort order. See SortOrderTypes.

default_forum_layout: Optional[int] instance-attribute

Default forum layout view. Defaults to ForumLayoutTypes.NOT_SET. See ForumLayoutTypes.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss

user_can

Checks permissions to see if permission bit is toggled.

Warning

If permission field is None, this function always returns False.

Parameters:

  • permission_bit (int) –

    permission bit. See Permissions.

Returns:

  • bool

    whether the user has this permission


ChannelUpdateEvent dataclass

Bases: Event, ChannelModel

Received when a guild channel has been updated.

Note

Not send when last_message_id is changed.

id: int instance-attribute

ID of the channel.

type: int instance-attribute

Type of channel.

guild_id: Optional[int] instance-attribute

Guild ID of the channel.

parent_id: Optional[int] instance-attribute

Category ID of the channel.

position: Optional[int] instance-attribute

Position of the channel.

name: str instance-attribute

Dispatch name of event.

topic: Optional[str] instance-attribute

Topic of the channel.

nsfw: Optional[bool] instance-attribute

If the channel is flagged NSFW.

last_message_id: Optional[int] instance-attribute

ID of the last message sent in the channel.

rate_limit_per_user: Optional[int] instance-attribute

Seconds user must wait between sending messages in the channel.

recipients: Optional[list[UserModel]] instance-attribute

Recipients of the DM.

icon: Optional[str] instance-attribute

Icon hash of the group DM.

owner_id: Optional[int] instance-attribute

ID of the creator of the group DM or thread.

application_id: Optional[int] instance-attribute

ID of the application that created the DM or thread.

last_pin_timestamp: Optional[str] instance-attribute

ISO8601 timestamp of the last pinned messsage in the channel.

permissions: Optional[int] instance-attribute

Permissions for the invoking user in this channel. Includes role and overwrite calculations. [INT_LIMIT]

thread_metadata: Optional[ThreadMetadataModel] instance-attribute

Thread-specific fields not needed by other channels.

member: Optional[ThreadMemberModel] instance-attribute

Thread member object for the current user if they have joined the thread.

default_auto_archive_duration: Optional[int] instance-attribute

Default duration in minutes threads will be hidden after period of inactivity.

flags: Optional[int] instance-attribute

Channel flags combined as a bitfield. See ChannelFlags.

available_tags: Optional[list[TagModel]] instance-attribute

Set of tags that can be applied to a GUILD_FORUM post.

applied_tags: Optional[list[int]] instance-attribute

Set of tags applied to a GUILD_FORUM post.

default_reaction_emoji: Optional[DefaultReactionModel] instance-attribute

Emoji to show in the add reaction button in a GUILD_FORUM post.

default_thread_rate_limit_per_user: Optional[int] instance-attribute

Rate limit per user set on newly created threads.

Note

This field does not live update!

default_sort_order: Optional[int] instance-attribute

Default forum sort order. See SortOrderTypes.

default_forum_layout: Optional[int] instance-attribute

Default forum layout view. Defaults to ForumLayoutTypes.NOT_SET. See ForumLayoutTypes.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss

user_can

Checks permissions to see if permission bit is toggled.

Warning

If permission field is None, this function always returns False.

Parameters:

  • permission_bit (int) –

    permission bit. See Permissions.

Returns:

  • bool

    whether the user has this permission


ChannelDeleteEvent dataclass

Bases: Event, ChannelModel

Received when a guild channel has been deleted.

id: int instance-attribute

ID of the channel.

type: int instance-attribute

Type of channel.

guild_id: Optional[int] instance-attribute

Guild ID of the channel.

parent_id: Optional[int] instance-attribute

Category ID of the channel.

position: Optional[int] instance-attribute

Position of the channel.

name: str instance-attribute

Dispatch name of event.

topic: Optional[str] instance-attribute

Topic of the channel.

nsfw: Optional[bool] instance-attribute

If the channel is flagged NSFW.

last_message_id: Optional[int] instance-attribute

ID of the last message sent in the channel.

rate_limit_per_user: Optional[int] instance-attribute

Seconds user must wait between sending messages in the channel.

recipients: Optional[list[UserModel]] instance-attribute

Recipients of the DM.

icon: Optional[str] instance-attribute

Icon hash of the group DM.

owner_id: Optional[int] instance-attribute

ID of the creator of the group DM or thread.

application_id: Optional[int] instance-attribute

ID of the application that created the DM or thread.

last_pin_timestamp: Optional[str] instance-attribute

ISO8601 timestamp of the last pinned messsage in the channel.

permissions: Optional[int] instance-attribute

Permissions for the invoking user in this channel. Includes role and overwrite calculations. [INT_LIMIT]

thread_metadata: Optional[ThreadMetadataModel] instance-attribute

Thread-specific fields not needed by other channels.

member: Optional[ThreadMemberModel] instance-attribute

Thread member object for the current user if they have joined the thread.

default_auto_archive_duration: Optional[int] instance-attribute

Default duration in minutes threads will be hidden after period of inactivity.

flags: Optional[int] instance-attribute

Channel flags combined as a bitfield. See ChannelFlags.

available_tags: Optional[list[TagModel]] instance-attribute

Set of tags that can be applied to a GUILD_FORUM post.

applied_tags: Optional[list[int]] instance-attribute

Set of tags applied to a GUILD_FORUM post.

default_reaction_emoji: Optional[DefaultReactionModel] instance-attribute

Emoji to show in the add reaction button in a GUILD_FORUM post.

default_thread_rate_limit_per_user: Optional[int] instance-attribute

Rate limit per user set on newly created threads.

Note

This field does not live update!

default_sort_order: Optional[int] instance-attribute

Default forum sort order. See SortOrderTypes.

default_forum_layout: Optional[int] instance-attribute

Default forum layout view. Defaults to ForumLayoutTypes.NOT_SET. See ForumLayoutTypes.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss

user_can

Checks permissions to see if permission bit is toggled.

Warning

If permission field is None, this function always returns False.

Parameters:

  • permission_bit (int) –

    permission bit. See Permissions.

Returns:

  • bool

    whether the user has this permission


ChannelPinsUpdateEvent dataclass

Bases: Event, DataModel

Pin update event.

channel_id: int instance-attribute

ID of channel where the pins were updated.

guild_id: Optional[int] instance-attribute

ID of the guild where the pins were updated.

last_pin_timestamp: Optional[str] instance-attribute

ISO8601 formatted timestamp of the last pinned message in the channel.

name: str instance-attribute

Dispatch name of event.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss


WebhooksUpdateEvent dataclass

Bases: Event, DataModel

Received when a guild's channel webhook is created, updated, or deleted.

guild_id: int instance-attribute

ID of the guild.

channel_id: int instance-attribute

ID of the channel.

name: str instance-attribute

Dispatch name of event.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss