Thread Events¶
Note
The following classes come from the scurrypy.events.thread_events module.
ThreadCreateEvent
dataclass
¶
Bases: Event, ChannelModel
Received when a thread is created.
newly_created: bool
instance-attribute
¶
Whether the thread has just 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
ThreadUpdateEvent
dataclass
¶
Bases: Event, ChannelModel
Received when a thread is 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
ThreadDeleteEvent
dataclass
¶
Received when a thread is deleted.
id: int
instance-attribute
¶
ID of the thread.
guild_id: Optional[int]
instance-attribute
¶
Guild ID of the thread.
parent_id: int
instance-attribute
¶
ID of the parent channel.
type: int
instance-attribute
¶
Type of thread.
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
ThreadMemberUpdateEvent
dataclass
¶
Bases: Event, ThreadMemberModel
Received when a thread member for the bot is updated.
guild_id: int
instance-attribute
¶
ID of the guild.
id: Optional[int]
instance-attribute
¶
ID of the thread.
user_id: Optional[int]
instance-attribute
¶
ID of the user.
join_timestamp: str
instance-attribute
¶
ISO8601 timestamp of when the user last joined the thread.
member: Optional[GuildMemberModel]
instance-attribute
¶
Additional information about the user.
Note
Only present when with_member is toggled on request.
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
ThreadMembersUpdateEvent
dataclass
¶
Received when someone is added or removed from a thread.
Important
Without the GUILD_MEMBERS privileged intent, this event only fires if the
bot was added or removed from a thread.
id: int
instance-attribute
¶
ID of the thread.
guild_id: int
instance-attribute
¶
ID of the guild.
member_count: int
instance-attribute
¶
Approximate number of members in the thread (max 50).
added_members: Optional[list[ThreadMemberModel]]
instance-attribute
¶
Users who were added to the thread
removed_member_ids: Optional[list[int]]
instance-attribute
¶
ID of the users who were removed from the thread.
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
ThreadListSyncEvent
dataclass
¶
Received when the bot gains access to a channel.
guild_id: int
instance-attribute
¶
ID of the guild.
channel_ids: Optional[list[int]]
instance-attribute
¶
Parent channel IDs of the threads being synced.
threads: list[ChannelModel]
instance-attribute
¶
Active threads in the given channel that the bot can access.
members: list[ThreadMemberModel]
instance-attribute
¶
Thread members from the synced threads that the bot an access.
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