Channel Models¶
Note
The following classes come from the scurrypy.models.channel module.
ChannelModel
dataclass
¶
Bases: DataModel
Represents a Discord guild channel.
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: Optional[str]
instance-attribute
¶
Name of the channel.
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.
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
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
TagModel
dataclass
¶
Bases: DataModel
Represents the tag object found in GUILD_FORUM channels.
id: int
instance-attribute
¶
ID of the tag.
name: str
instance-attribute
¶
Name of the tag.
moderated: bool
instance-attribute
¶
Whether the tag can only be added/removed by a member with MANAGE_THREADS.
emoji_id: int
instance-attribute
¶
ID of a guild's custom emoji.
emoji_name: str
instance-attribute
¶
Unicode character of the emoji.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
DefaultReactionModel
dataclass
¶
Bases: DataModel
Represents the default reaction for a GUILD_FORUM post.
ThreadMetadataModel
dataclass
¶
Bases: DataModel
Represents the thread metadata object.
archived: bool
instance-attribute
¶
Whether the thread is archived.
auto_archive_duration: int
instance-attribute
¶
How long to wait until the thread is hidden (in minutes).
archive_timestamp: str
instance-attribute
¶
ISO8601 timestamp of when the thread's archive status was last changed.
locked: bool
instance-attribute
¶
Whether the thread is locked.
Note
Only users with MANAGE_THREADS can unarchive the thread.
invitable: Optional[bool]
instance-attribute
¶
Whether non-moderators can add other non-moderators to the thread (private threads only).
create_timestamp: Optional[str]
instance-attribute
¶
ISO8601 timestamp of thread creation (field only exists after Jan 09, 2022).
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
ThreadMemberModel
dataclass
¶
Bases: DataModel
Represents a user that has joined a thread.
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.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
ArchivedThreadsModel
dataclass
¶
Bases: DataModel
Response body for fetching archived threads.
threads: list[ChannelModel]
instance-attribute
¶
The archived threads.
members: list[ThreadMemberModel]
instance-attribute
¶
Thread member for each returned thread the bot has joined.
has_more: bool
instance-attribute
¶
Whether there are additional threads to be returned with subsequent calls.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
ActiveThreadsModel
dataclass
¶
Bases: DataModel
Response body for fetching active guild threads.
threads: list[ChannelModel]
instance-attribute
¶
The arctive threads.
members: list[ThreadMemberModel]
instance-attribute
¶
Thread member for each returned thread the bot has joined.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss