Skip to content

Channel API

Note

The following classes come from the scurrypy.parts.channel module.


GuildChannelPart dataclass

Bases: DataModel

Parameters for creating a guild channel.

name: str = None class-attribute instance-attribute

Name of the channel.

type: Optional[int] = None class-attribute instance-attribute

Type of channel. See ChannelTypes.

topic: Optional[str] = None class-attribute instance-attribute

Topic of the channel.

position: Optional[int] = None class-attribute instance-attribute

Sorting position of the channel (channels with the same position are sorted by id).

rate_limit_per_user: Optional[int] = None class-attribute instance-attribute

Seconds user must wait between sending messages in the channel.

Note

Only works for GUILD_TEXT and GUILD_FORUM.

parent_id: Optional[int] = None class-attribute instance-attribute

Category ID of the channel.

Note

Only works for GUILD_TEXT, GUILD_ANNOUNCEMENT, and GUILD_FORUM.

nsfw: Optional[bool] = None class-attribute instance-attribute

If the channel is flagged NSFW.

Note

Only works for GUILD_TEXT, GUILD_ANNOUNCEMENT, and GUILD_FORUM.

default_auto_archive_duration: Optional[int] = None class-attribute instance-attribute

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

Note

Only works for GUILD_TEXT, GUILD_ANNOUNCEMENT, and GUILD_FORUM.

default_reaction_emoji: Optional[DefaultReactionPart] = None class-attribute instance-attribute

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

Note

Only works for GUILD_FORUM.

available_tags: Optional[list[TagPart]] = None class-attribute instance-attribute

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

Note

Only works for GUILD_FORUM.

default_sort_order: Optional[int] = None class-attribute instance-attribute

Default forum sort order. See SortOrderTypes.

Note

Only works for GUILD_FORUM.

default_forum_layout: Optional[int] = None class-attribute instance-attribute

Default forum layout view. See ForumLayoutTypes.

Note

Only works for GUILD_FORUM.

default_thread_rate_limit_per_user: Optional[int] = None class-attribute instance-attribute

Rate limit per user set on newly created threads.

Note

This field does not live update!

Note

Only works for GUILD_TEXT, GUILD_ANNOUNCEMENT, and GUILD_FORUM.

to_dict

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

Returns:

  • dict

    serialized dataclasss


ThreadFromMessagePart dataclass

Bases: DataModel

Parameters for creating a thread attached to a message.

name: str = None class-attribute instance-attribute

Name of the thread.

rate_limit_per_user: Optional[int] = None class-attribute instance-attribute

Seconds user must wait between sending messages in the channel.

auto_archive_duration: Optional[Literal[60, 1440, 4320, 10080]] = None class-attribute instance-attribute

Duration in minutes threads will be hidden after period of inactivity.

to_dict

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

Returns:

  • dict

    serialized dataclasss


ThreadWithoutMessagePart dataclass

Bases: DataModel

Parameters for creating a thread without a message.

name: str = None class-attribute instance-attribute

Name of the thread.

rate_limit_per_user: Optional[int] = None class-attribute instance-attribute

Seconds user must wait between sending messages in the channel.

auto_archive_duration: Optional[Literal[60, 1440, 4320, 10080]] = None class-attribute instance-attribute

Duration in minutes threads will be hidden after period of inactivity.

type: Optional[int] = ChannelTypes.PRIVATE_THREAD class-attribute instance-attribute

Type of thread to create.

invitable: Optional[bool] = None class-attribute instance-attribute

Whether non-moderators can add other non-moderators to the thread (private threads only).

to_dict

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

Returns:

  • dict

    serialized dataclasss


DefaultReactionPart dataclass

Bases: DataModel

Represents the default reaction for a GUILD_FORUM post.

emoji_id: int = None class-attribute instance-attribute

ID of the guild's custom emoji.

emoji_name: str = None class-attribute instance-attribute

Unicode character of the emoji.

to_dict

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

Returns:

  • dict

    serialized dataclasss


TagPart dataclass

Bases: DataModel

Represents the tag object found in GUILD_FORUM channels.

name: str = None class-attribute instance-attribute

Name of the tag.

moderated: bool = None class-attribute instance-attribute

Whether the tag can only be added/removed by a member with MANAGE_THREADS.

emoji_id: int = None class-attribute instance-attribute

ID of a guild's custom emoji.

emoji_name: str = None class-attribute instance-attribute

Unicode character of the emoji.

to_dict

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

Returns:

  • dict

    serialized dataclasss


ChannelTypes

Represents the types of channels.

GUILD_TEXT = 0 class-attribute instance-attribute

Text channel within a guild.

GUILD_CATEGORY = 4 class-attribute instance-attribute

Organizational category for channels.

GUILD_ANNOUNCEMENT = 5 class-attribute instance-attribute

Channel users can follow and crosspost into their own server.

ANNOUNCEMENT_THREAD = 10 class-attribute instance-attribute

Temporary sub-channel within a GUILD_ANNOUNCEMENT channel.

PUBLIC_THREAD = 11 class-attribute instance-attribute

Temporary sub-channel within a GUILD_TEXT or GUILD_FORUM channel.

PRIVATE_THREAD = 12 class-attribute instance-attribute

Temporary sub-channel within a GUILD_TEXT channel only viewable by invitees and members with MANAGE_THREADS.

GUILD_DIRECTORY = 14 class-attribute instance-attribute

Channel in a hub containing the listed servers.

GUILD_FORUM = 15 class-attribute instance-attribute

Channel that can only contain threads.


ForumLayoutTypes

Represents GUILD_FORUM layout types.

NOT_SET = 0 class-attribute instance-attribute

No default layout has been set.

LIST_VIEW = 1 class-attribute instance-attribute

Display posts as a list.

GALLERY_VIEW = 2 class-attribute instance-attribute

Display posts as a collection of tiles.


SortOrderTypes

Represents sort order types for GUILD_FORUM channels.

LATEST_ACTIVITY = 0 class-attribute instance-attribute

Sort by activity.

CREATION_DATE = 1 class-attribute instance-attribute

Sort by creation time (recent to oldest).


ChannelFlags

Represents constant bit fields for channel flags.

PINNED = 1 << 1 class-attribute instance-attribute

This thread is pinned to the top of its parent GUILD_FORUM channel.

REQUIRE_TAG = 1 << 4 class-attribute instance-attribute

Whether a tag is required when creating a thread in a GUILD_FORUM channel.