Channels#
Manager#
- class ChannelManager(state: ConnectionState, cache: CacheStorage)#
Bases:
BaseManagerManager used to fetch
Channelobjects.- get(channel_id: int) Channel | None#
Attempts to fetch a
Channelfrom the internal cache of the bot.
- async fetch(channel_id: int) Channel#
Attempts to fetch a
Channelfrom the Discord API.- Parameters:
channel_id (
int) – The channel_id of the channel to fetch.- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to fetch that channel.
HTTPException – A HTTP error occured.
- async get_or_fetch(channel_id: int) Channel#
A couroutine function that attempts to fetch a
Channelfrom internal cache and if not present, makes an API call to discord.- Parameters:
channel_id (
int) – The channel_id of the channel to fetch.- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to fetch that channel.
HTTPException – A HTTP error occured.
- async edit(channel_id: int, *, name: str = _MISSING, type: ChannelType = _MISSING, position: int | None = _MISSING, topic: str | None = _MISSING, nsfw: bool | None = _MISSING, rate_limit_per_user: int | None = _MISSING, bitrate: int | None = _MISSING, user_limit: int | None = _MISSING, permission_overwrites: list[ChannelPermissionOverwrite] | None = _MISSING, parent_id: int | None = _MISSING, rtc_region: str | None = _MISSING, video_quality_mode: VideoQualityMode | None = _MISSING, default_auto_archive_duration: int | None = _MISSING, flags: ChannelFlags = _MISSING, available_tags: list[PartialForumTag] = _MISSING, default_reaction_emoji: DefaultReaction | None = _MISSING, default_thread_rate_limit_per_user: int = _MISSING, default_sort_order: SortOrderType | None = _MISSING, default_forum_layout: ForumLayoutType = _MISSING, archived: bool = _MISSING, auto_archive_duration: int = _MISSING, invitable: bool = _MISSING, locked: bool = _MISSING, applied_tags: list[int] = _MISSING) GuildChannel | ThreadChannel#
- async edit(channel_id: int, *, name: str = _MISSING, type: ChannelType = _MISSING, position: int | None = _MISSING, topic: str | None = _MISSING, nsfw: bool | None = _MISSING, rate_limit_per_user: int | None = _MISSING, bitrate: int | None = _MISSING, user_limit: int | None = _MISSING, permission_overwrites: list[ChannelPermissionOverwrite] | None = _MISSING, parent_id: int | None = _MISSING, rtc_region: str | None = _MISSING, video_quality_mode: VideoQualityMode | None = _MISSING, default_auto_archive_duration: int | None = _MISSING, flags: ChannelFlags = _MISSING, available_tags: list[PartialForumTag] = _MISSING, default_reaction_emoji: DefaultReaction | None = _MISSING, default_thread_rate_limit_per_user: int = _MISSING, default_sort_order: SortOrderType | None = _MISSING, default_forum_layout: ForumLayoutType = _MISSING, archived: bool = _MISSING, auto_archive_duration: int = _MISSING, invitable: bool = _MISSING, locked: bool = _MISSING, applied_tags: list[int] = _MISSING, to_update: T) T
Modifies a channel.
Requires the
MANAGE_CHANNELSfor a guild channel orMANAGE_THREADSfor a thread. Additionally, requiresMANAGE_ROLESif modifying the permissions.Note
All parameters besides
channel_idare optional.- Parameters:
channel_id (
int) – The ID of the channel.name (
str) – The name of the channel. (1-100 characters)type (
ChannelType) – The new type of the channel. Only the conversion between aGUILD_TEXTchannel and aGUILD_ANNOUNCEMENTchannel is supported.position (
int|None) – The position of the channel.topic (
str|None) – The topic of the channel. 0-4096 character limit forGUILD_FORUMandGUILD_MEDIA, 0-1024 for all others.nsfw (
bool|None) – Whether the channel is NSFW.rate_limit_per_user (
int|None) – The amount of seconds the user has to wait before sending a message again. (0-21600 seconds)bitrate (
int|None) – The bitrate of the voice or stage channel. Minimum 8000.user_limit (
int|None) – The user limit for the voice or the stage channel. 0 for no limit. Max 99 for voice channels and 10,000 for stage channels.permission_overwrites (list[
ChannelPermissionOverwrite] |None) – The channel or category-specific permissions.parent_id (
int|None) – The ID of the nww parent category for a channel.rtc_region (
str|None) – The voice region of the channel. Sets to automatic whenNoneis provided.video_quality_mode (
VideoQualityMode|None) – The camera video quality mode of the channel.default_auto_archive_duration (
int) – The default auto archive duration that the clients use for newly created threads in the channel, in minutes.flags (
ChannelFlags) – The flags for the channel.available_tags (list[
PartialForumTag]) – The set of tags that can be used in aGUILD_FORUMandGUILD_MEDIAchannel. Max 20.default_reaction_emoji (
DefaultReaction) – The default emoji reaction shown in the add reaction button on threads.default_thread_rate_limit_per_user (
int) – The rate limit per user to set on newly created threads. Only synced on creation of thread.default_sort_order (
SortOrderType) – The default sort order used for posts in aGUILD_FORUMandGUILD_MEDIAchannel.default_forum_layout (
ForumLayoutType) – The default forum layout used inGUILD_FORUMchannel.archived (
bool) – Whether the thread is archived.auto_archive_duration (
int) – The minutes of inactivity after which the thread will be archived.locked (
bool) – Whether the thread is locked.invitable (
bool) – Whether non-moderators can add other non-moderators to this thread. Only available on private threads.applied_tags (list[
int]) – The IDs of tags applied to a thread in aGUILD_FORUMandGUILD_MEDIAchannel. Max 5.
- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to edit that channel.
HTTPException – A HTTP error occured.
- async edit_guild_channel(channel_id: int, *, name: str = <mizuki._utils.Missing object>, type: ChannelType = <mizuki._utils.Missing object>, position: int | None = <mizuki._utils.Missing object>, topic: str | None = <mizuki._utils.Missing object>, nsfw: bool | None = <mizuki._utils.Missing object>, rate_limit_per_user: int | None = <mizuki._utils.Missing object>, bitrate: int | None = <mizuki._utils.Missing object>, user_limit: int | None = <mizuki._utils.Missing object>, permission_overwrites: list[ChannelPermissionOverwrite] | None = <mizuki._utils.Missing object>, parent_id: int | None = <mizuki._utils.Missing object>, rtc_region: str | None = <mizuki._utils.Missing object>, video_quality_mode: VideoQualityMode | None = <mizuki._utils.Missing object>, default_auto_archive_duration: int | None = <mizuki._utils.Missing object>, require_tag: bool = <mizuki._utils.Missing object>, hide_media_download_options: bool = <mizuki._utils.Missing object>, available_tags: list[PartialForumTag] = <mizuki._utils.Missing object>, default_reaction_emoji: DefaultReaction | None = <mizuki._utils.Missing object>, default_thread_rate_limit_per_user: int = <mizuki._utils.Missing object>, default_sort_order: SortOrderType | None = <mizuki._utils.Missing object>, default_forum_layout: ForumLayoutType = <mizuki._utils.Missing object>, to_update: GuildChannel = <mizuki._utils.Missing object>) GuildChannel#
Modifies a channel.
Requires the
MANAGE_CHANNELS. Additionally, requiresMANAGE_ROLESif modifying the permissions.Note
All parameters besides
channel_idare optional.- Parameters:
channel_id (
int) – The ID of the channel.name (
str) – The name of the channel. (1-100 characters)type (
ChannelType) – The new type of the channel. Only the conversion between aGUILD_TEXTchannel and aGUILD_ANNOUNCEMENTchannel is supported.position (
int|None) – The position of the channel.topic (
str|None) – The topic of the channel. 0-4096 character limit forGUILD_FORUMandGUILD_MEDIA, 0-1024 for all others.nsfw (
bool|None) – Whether the channel is NSFW.rate_limit_per_user (
int|None) – The amount of seconds the user has to wait before sending a message again. (0-21600 seconds)bitrate (
int|None) – The bitrate of the voice or stage channel. Minimum 8000.user_limit (
int|None) – The user limit for the voice or the stage channel. 0 for no limit. Max 99 for voice channels and 10,000 for stage channels.permission_overwrites (list[
ChannelPermissionOverwrite] |None) – The channel or category-specific permissions.parent_id (
int|None) – The ID of the new parent category for a channel.rtc_region (
str|None) – The voice region of the channel. Sets to automatic whenNoneis provided.video_quality_mode (
VideoQualityMode|None) – The camera video quality mode of the channel.default_auto_archive_duration (
int) – The default auto archive duration that the clients use for newly created threads in the channel, in minutes.require_tag (
bool) – Whether theREQUIRE_TAGis added to the flags.hide_media_download_options (
bool) – Whether theHIDE_MEDIA_DOWNLOAD_OPTIONSis added to the flags.available_tags (list[
PartialForumTag]) – The set of tags that can be used in aGUILD_FORUMandGUILD_MEDIAchannel. Max 20.default_reaction_emoji (
DefaultReaction) – The default emoji reaction shown in the add reaction button on threads.default_thread_rate_limit_per_user (
int) – The rate limit per user to set on newly created threads. Only synced on creation of thread.default_sort_order (
SortOrderType) – The default sort order used for posts in aGUILD_FORUMandGUILD_MEDIAchannel.default_forum_layout (
ForumLayoutType) – The default forum layout used inGUILD_FORUMchannel.
- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to edit that channel.
HTTPException – A HTTP error occured.
- async edit_thread(thread_id: int, *, name: str = <mizuki._utils.Missing object>, archived: bool = <mizuki._utils.Missing object>, auto_archive_duration: int = <mizuki._utils.Missing object>, rate_limit_per_user: int | None = <mizuki._utils.Missing object>, locked: bool = <mizuki._utils.Missing object>, invitable: bool = <mizuki._utils.Missing object>, pinned: bool = <mizuki._utils.Missing object>, applied_tags: list[int] = <mizuki._utils.Missing object>, to_update: ThreadChannel = <mizuki._utils.Missing object>) ThreadChannel#
Modifies a thread.
Requires the
MANAGE_THREADS.Note
All parameters besides
channel_idare optional.- Parameters:
channel_id (
int) – The ID of the channel.name (
str) – The name of the channel. (1-100 characters)archived (
bool) – Whether the thread is archived.auto_archive_duration (
int) – The minutes of inactivity after which the thread will be archived.rate_limit_per_user (
int|None) – The amount of seconds the user has to wait before sending a message again. (0-21600 seconds)locked (
bool) – Whether the thread is locked.invitable (
bool) – Whether non-moderators can add other non-moderators to this thread. Only available on private htewads.applied_tags (list[
int]) – The IDs of tags applied to a thread in aGUILD_FORUMandGUILD_MEDIAchannel. Max 5.
- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to edit that thread.
HTTPException – A HTTP error occured.
- async set_voice_status(channel_id: int, *, status: str | None) None#
Set a voice channel’s status.
Requires the
SET_VOICE_CHANNEL_STATUSpermission, and additionally theMANAGE_CHANNELSpermission if the current user is not connected to the voice channel.- Parameters:
- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to edit that voice status.
HTTPException – A HTTP error occured.
- async delete(channel_id: int) Channel#
Deletes a channel or closes a private channel.
Requires the
MANAGE_CHANNELSfor a guild channel orMANAGE_THREADSfor a thread.Deleting a category does not delete its child channels.
- Parameters:
channel_id (
int) – The ID of the channel.- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to delete that channel.
HTTPException – A HTTP error occured.
- async edit_permissions(channel_id: int, *, overwrite: ChannelPermissionOverwrite) None#
Edits permissions for a role or a user for a channel.
- Parameters:
channel_id (
int) – The ID of the channel.overwrite (
ChannelPermissionOverwrite) – The overwrite object to overwrite with.
- Raises:
NotFound – Could not find an channel with that ID or the role or the user with the ID in the overwrite object.
Forbidden – You are not allowed to edit permissions for that channel and/or role or user.
HTTPException – A HTTP error occured.
Objects#
- class ThreadMetaData(data: ThreadMetaDataPayload)#
Bases:
objectRepresents the metadata of a thread.
- auto_archive_duration: timedelta#
The amount of time before the thread is auto-archived. Can only be 60, 1440, 4320, 10080 in terms of minutes.
- archive_timestamp: datetime#
Represents when the thread’s archive status was last changed, used for calculating recent activity
- class ThreadMember(data: ThreadMemberPayload, guild_id: int | None = None, user_id: int | None = None, *, state: ConnectionState)#
Bases:
objectRepresents information about an user that has joined a thread.
- id: Snowflake | None#
The ID of the
Thread. Omitted inGUILD_CREATE.
- user_id: Snowflake | None#
The ID of the
User. Omitted inGUILD_CREATE.
- member: Member | None#
The Member Object for the user in the
Guild. Omitted inGUILD_CREATE.
- class PartialForumTag(data: PartialForumTagPayload)#
Bases:
objectRepresents a partial Forum Tag object to be passed for editing the available tags of a channel.
- class ForumTag(data: ForumTagPayload)#
Bases:
PartialForumTagRepresents a Forum Tag which can be applied to Channels of types
GUILD_FORUMandGUILD_MEDIA.Note
Atleast one of
emoji_idandemoji_namewill always be present.- moderated: bool#
Whether this Tag can only be added to or removed from valid ChannelType by a member with the
MANAGE_THREADSpermission.
- class GuildChannel(data: GuildChannelPayload, guild_id: int | None = None, *, state: ConnectionState)#
Bases:
BasePublicChannelRepresents a Channel/Category in a Guild.
Channel Types#
- type: ChannelType#
The type of this Channel.
- parent_id: Snowflake | None#
The ID of the category (channel of
GUILD_CATEGORY), if any.
- topic: str | None#
The topic of the channel. 0-4096 character limit for
GUILD_FORUMandGUILD_MEDIA, 0-1024 for all others.
- default_auto_archive_duration: timedelta | None#
The default amount of time before a newly created
threadis auto-archived. Can only be 60, 1440, 4320, 10080 in terms of minutes.
- default_thread_rate_limit_per_user: int | None#
The default rate limit for new
threads. Does not live-update with the channel’s rate limit. Bots remain unaffected.
- position: int | None#
Sorting position of the channel (Channels with the same position are sorted by id)
- permission_overwrites: list[ChannelPermissionOverwrite]#
Explicit permission overwrites for member and roles.
- available_tags: list[ForumTag]#
The list of tags that can be used in
GUILD_FORUMandGUILD_MEDIAchannels.
- default_sort_order: SortOrderType | None#
Default sortorder used when posting in a
GUILD_FORUMandGUILD_MEDIAchannel.Noneindicates that the setting hasn’t been set by an admin.
- default_forum_layout: ForumLayoutType | None#
The default ForumLayout used to display posts in
GUILD_FORUMchannels.
- bitrate: int | None#
The bitrate in bits/second for a voice channel. (
GUILD_VOICEandGUILD_STAGE_VOICE).
- user_limit: int | None#
The User Limit for a voice channel. (
GUILD_VOICEandGUILD_STAGE_VOICE).
- rtc_region: str | None#
The RTC Region ID for a voice channel. (
GUILD_VOICEandGUILD_STAGE_VOICE).
- video_quality_mode: VideoQualityMode#
The VideoQualityMode of the channel, default
AUTO.
- flags: ChannelFlags#
The flags of the Channel.
- last_message_id: Snowflake | None#
The ID of the last message (or
ThreadforGUILD_FORUMandGUILD_MEDIA) that was sent in that channel. May or may not point to a valid message.
- last_pin_timestamp: datetime | None#
The timestamp when the last pinned message was pinned. May be
Noneif no messages are pinned.
- permissions: Permissions | None#
Computed permissions for the invoking user in the channel, including overwrites, only included when part of the
Resolved Datareceived on anInteraction. This does not include implicit permissions, which may need to be checked separately
- rate_limit_per_user: int | None#
The amount of time an user has to wait before sending a message (Slowmode). Bots remain unaffected.
- async send(content: str = <mizuki._utils.Missing object>, *, tts: bool = <mizuki._utils.Missing object>, embeds: list[Embed] = <mizuki._utils.Missing object>, allowed_mentions: AllowedMentions = <mizuki._utils.Missing object>, message_reference: MessageReference = <mizuki._utils.Missing object>, files: list[File] = <mizuki._utils.Missing object>, sticker_ids: list[int] = <mizuki._utils.Missing object>, flags: MessageFlags = <mizuki._utils.Missing object>) Message#
Creates a new message in the specified channel.
Note
At least one of,
content,embeds,sticker_ids,filesmust be provided. For forwarding, onlymessage_referencemust be provided.- Parameters:
content (
str) – The content of the message.tts (
bool) – Whether TTS is enabled for the message.embeds (list[
Embed]) – The list of embeds to send along the message.allowed_mentions (
AllowedMentions) – The AllowedMentions object that dictates whether user, role or everyone pings are enabled.files (list[
File]) – The files to upload with the message.message_reference (
MessageReference) – The reference message for the new message, if anysticker_ids (list[
int]) – The Guild Stickers to send with the message. Max 3.flags (
MessageFlags) – The MessageFlags of the new message.
- Raises:
NotFound – The channel you tried to send to doesn’t exist.
Forbidden – You are not allowed to send the message. You may be missing a specific permission.
HTTPException – A HTTP error occurred.
- async edit(*, name: str = <mizuki._utils.Missing object>, type: ChannelType = <mizuki._utils.Missing object>, position: int | None = <mizuki._utils.Missing object>, topic: str | None = <mizuki._utils.Missing object>, nsfw: bool | None = <mizuki._utils.Missing object>, rate_limit_per_user: int | None = <mizuki._utils.Missing object>, bitrate: int | None = <mizuki._utils.Missing object>, user_limit: int | None = <mizuki._utils.Missing object>, permission_overwrites: list[ChannelPermissionOverwrite] | None = <mizuki._utils.Missing object>, parent_id: int | None = <mizuki._utils.Missing object>, rtc_region: str | None = <mizuki._utils.Missing object>, video_quality_mode: VideoQualityMode | None = <mizuki._utils.Missing object>, default_auto_archive_duration: int | None = <mizuki._utils.Missing object>, require_tag: bool = <mizuki._utils.Missing object>, hide_media_download_options: bool = <mizuki._utils.Missing object>, available_tags: list[PartialForumTag] = <mizuki._utils.Missing object>, default_reaction_emoji: DefaultReaction | None = <mizuki._utils.Missing object>, default_thread_rate_limit_per_user: int = <mizuki._utils.Missing object>, default_sort_order: SortOrderType | None = <mizuki._utils.Missing object>, default_forum_layout: ForumLayoutType = <mizuki._utils.Missing object>) GuildChannel#
Modifies a channel.
Requires the
MANAGE_CHANNELS. Additionally, requiresMANAGE_ROLESif modifying the permissions.Note
All parameters are optional.
- Parameters:
name (
str) – The name of the channel. (1-100 characters)type (
ChannelType) – The new type of the channel. Only the conversion between aGUILD_TEXTchannel and aGUILD_ANNOUNCEMENTchannel is supported.position (
int|None) – The position of the channel.topic (
str|None) – The topic of the channel. 0-4096 character limit forGUILD_FORUMandGUILD_MEDIA, 0-1024 for all others.nsfw (
bool|None) – Whether the channel is NSFW.rate_limit_per_user (
int|None) – The amount of seconds the user has to wait before sending a message again. (0-21600 seconds)bitrate (
int|None) – The bitrate of the voice or stage channel. Minimum 8000.user_limit (
int|None) – The user limit for the voice or the stage channel. 0 for no limit. Max 99 for voice channels and 10,000 for stage channels.permission_overwrites (list[
ChannelPermissionOverwrite] |None) – The channel or category-specific permissions.parent_id (
int|None) – The ID of the new parent category for a channel.rtc_region (
str|None) – The voice region of the channel. Sets to automatic whenNoneis provided.video_quality_mode (
VideoQualityMode|None) – The camera video quality mode of the channel.default_auto_archive_duration (
int) – The default auto archive duration that the clients use for newly created threads in the channel, in minutes.require_tag (
bool) – Whether theREQUIRE_TAGis added to the flags.hide_media_download_options (
bool) – Whether theHIDE_MEDIA_DOWNLOAD_OPTIONSis added to the flags.available_tags (list[
PartialForumTag]) – The set of tags that can be used in aGUILD_FORUMandGUILD_MEDIAchannel. Max 20.default_reaction_emoji (
DefaultReaction) – The default emoji reaction shown in the add reaction button on threads.default_thread_rate_limit_per_user (
int) – The rate limit per user to set on newly created threads. Only synced on creation of thread.default_sort_order (
SortOrderType) – The default sort order used for posts in aGUILD_FORUMandGUILD_MEDIAchannel.default_forum_layout (
ForumLayoutType) – The default forum layout used inGUILD_FORUMchannel.
- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to edit that channel.
HTTPException – A HTTP error occured.
- async set_voice_status(status: str | None) None#
Set a voice channel’s status.
Requires the
SET_VOICE_CHANNEL_STATUSpermission, and additionally theMANAGE_CHANNELSpermission if the current user is not connected to the voice channel.- Parameters:
status (
str|None) – The new voice channel status. Max 500 characters.- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to edit that voice status.
HTTPException – A HTTP error occured.
- async delete() None#
Deletes a channel.
Requires the
MANAGE_CHANNELS.Deleting a category does not delete its child channels.
- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to delete that channel.
HTTPException – A HTTP error occured.
- async edit_permissions(overwrite: ChannelPermissionOverwrite) None#
Edits permissions for a role or a user for a channel.
- Parameters:
overwrite (
ChannelPermissionOverwrite) – The overwrite object to overwrite with.- Raises:
NotFound – Could not find an channel with that ID or the role or the user with the ID in the overwrite object.
Forbidden – You are not allowed to edit permissions for that channel and/or role or user.
HTTPException – A HTTP error occured.
- class ThreadChannel(data: ThreadPayload, guild_id: int | None = None, *, state: ConnectionState)#
Bases:
BasePublicChannelRepresents a Thread Channel in a Guild.
Channel Types#
- flags: ChannelFlags#
The flags of the Channel.
- last_message_id: Snowflake | None#
The ID of the last message (or
ThreadforGUILD_FORUMandGUILD_MEDIA) that was sent in that channel. May or may not point to a valid message.
- last_pin_timestamp: datetime | None#
The timestamp when the last pinned message was pinned. May be
Noneif no messages are pinned.
- parent_id#
- permissions: Permissions | None#
Computed permissions for the invoking user in the channel, including overwrites, only included when part of the
Resolved Datareceived on anInteraction. This does not include implicit permissions, which may need to be checked separately
- rate_limit_per_user: int | None#
The amount of time an user has to wait before sending a message (Slowmode). Bots remain unaffected.
- async send(content: str = <mizuki._utils.Missing object>, *, tts: bool = <mizuki._utils.Missing object>, embeds: list[Embed] = <mizuki._utils.Missing object>, allowed_mentions: AllowedMentions = <mizuki._utils.Missing object>, message_reference: MessageReference = <mizuki._utils.Missing object>, files: list[File] = <mizuki._utils.Missing object>, sticker_ids: list[int] = <mizuki._utils.Missing object>, flags: MessageFlags = <mizuki._utils.Missing object>) Message#
Creates a new message in the specified channel.
Note
At least one of,
content,embeds,sticker_ids,filesmust be provided. For forwarding, onlymessage_referencemust be provided.- Parameters:
content (
str) – The content of the message.tts (
bool) – Whether TTS is enabled for the message.embeds (list[
Embed]) – The list of embeds to send along the message.allowed_mentions (
AllowedMentions) – The AllowedMentions object that dictates whether user, role or everyone pings are enabled.files (list[
File]) – The files to upload with the message.message_reference (
MessageReference) – The reference message for the new message, if anysticker_ids (list[
int]) – The Guild Stickers to send with the message. Max 3.flags (
MessageFlags) – The MessageFlags of the new message.
- Raises:
NotFound – The channel you tried to send to doesn’t exist.
Forbidden – You are not allowed to send the message. You may be missing a specific permission.
HTTPException – A HTTP error occurred.
- type: ChannelType#
The type of this channel.
- thread_metadata: ThreadMetaData#
Metadata of the thread.
- message_count: int#
The amount of messages present in this thread, is inaccurate when above 50 for threads made before July 1, 2022.
- applied_tags: list[Snowflake]#
The tags applied to a thead in a
GUILD_FORUMandGUILD_MEDIAchannel.
- async edit(*, name: str = <mizuki._utils.Missing object>, archived: bool = <mizuki._utils.Missing object>, auto_archive_duration: int = <mizuki._utils.Missing object>, rate_limit_per_user: int | None = <mizuki._utils.Missing object>, locked: bool = <mizuki._utils.Missing object>, invitable: bool = <mizuki._utils.Missing object>, pinned: bool = <mizuki._utils.Missing object>, applied_tags: list[int] = <mizuki._utils.Missing object>) ThreadChannel#
Modifies a thread.
Requires the
MANAGE_THREADS.Note
All parameters are optional.
- Parameters:
name (
str) – The name of the channel. (1-100 characters)archived (
bool) – Whether the thread is archived.auto_archive_duration (
int) – The minutes of inactivity after which the thread will be archived.rate_limit_per_user (
int|None) – The amount of seconds the user has to wait before sending a message again. (0-21600 seconds)locked (
bool) – Whether the thread is locked.invitable (
bool) – Whether non-moderators can add other non-moderators to this thread. Only available on private htewads.applied_tags (list[
int]) – The IDs of tags applied to a thread in aGUILD_FORUMandGUILD_MEDIAchannel. Max 5.
- Raises:
NotFound – Could not find an channel with that ID.
Forbidden – You are not allowed to edit that thread.
HTTPException – A HTTP error occured.
- async delete() None#
Deletes a thread.
Requires the
MANAGE_THREADS- Raises:
NotFound – Could not find an thread with that ID.
Forbidden – You are not allowed to delete that thread.
HTTPException – A HTTP error occured.
- class PrivateChannel(data: PrivateChannelPayload, *, state: ConnectionState)#
Bases:
BaseChannelRepresents a private (DM) channel.
- flags: ChannelFlags#
The flags of the Channel.
- last_message_id: Snowflake | None#
The ID of the last message (or
ThreadforGUILD_FORUMandGUILD_MEDIA) that was sent in that channel. May or may not point to a valid message.
- last_pin_timestamp: datetime | None#
The timestamp when the last pinned message was pinned. May be
Noneif no messages are pinned.
- async send(content: str = <mizuki._utils.Missing object>, *, tts: bool = <mizuki._utils.Missing object>, embeds: list[Embed] = <mizuki._utils.Missing object>, allowed_mentions: AllowedMentions = <mizuki._utils.Missing object>, message_reference: MessageReference = <mizuki._utils.Missing object>, files: list[File] = <mizuki._utils.Missing object>, sticker_ids: list[int] = <mizuki._utils.Missing object>, flags: MessageFlags = <mizuki._utils.Missing object>) Message#
Creates a new message in the specified channel.
Note
At least one of,
content,embeds,sticker_ids,filesmust be provided. For forwarding, onlymessage_referencemust be provided.- Parameters:
content (
str) – The content of the message.tts (
bool) – Whether TTS is enabled for the message.embeds (list[
Embed]) – The list of embeds to send along the message.allowed_mentions (
AllowedMentions) – The AllowedMentions object that dictates whether user, role or everyone pings are enabled.files (list[
File]) – The files to upload with the message.message_reference (
MessageReference) – The reference message for the new message, if anysticker_ids (list[
int]) – The Guild Stickers to send with the message. Max 3.flags (
MessageFlags) – The MessageFlags of the new message.
- Raises:
NotFound – The channel you tried to send to doesn’t exist.
Forbidden – You are not allowed to send the message. You may be missing a specific permission.
HTTPException – A HTTP error occurred.
- type: ChannelType#
The ChannelType of this Channel. Always
DM.
- async close() None#
Closes a private channel.
- Raises:
NotFound – Could not find an channel with that ID.
HTTPException – A HTTP error occured.
- class PartialGuildChannel(data: PartialGuildChannelPayload, guild_id: int | None, *, state: ConnectionState)#
Bases:
BasePublicChannelRepresents a Partial Channel/Category in a Guild.
Channel Types#
- flags: ChannelFlags#
The flags of the Channel.
- last_message_id: Snowflake | None#
The ID of the last message (or
ThreadforGUILD_FORUMandGUILD_MEDIA) that was sent in that channel. May or may not point to a valid message.
- last_pin_timestamp: datetime | None#
The timestamp when the last pinned message was pinned. May be
Noneif no messages are pinned.
- permissions: Permissions | None#
Computed permissions for the invoking user in the channel, including overwrites, only included when part of the
Resolved Datareceived on anInteraction. This does not include implicit permissions, which may need to be checked separately
- rate_limit_per_user: int | None#
The amount of time an user has to wait before sending a message (Slowmode). Bots remain unaffected.
- async send(content: str = <mizuki._utils.Missing object>, *, tts: bool = <mizuki._utils.Missing object>, embeds: list[Embed] = <mizuki._utils.Missing object>, allowed_mentions: AllowedMentions = <mizuki._utils.Missing object>, message_reference: MessageReference = <mizuki._utils.Missing object>, files: list[File] = <mizuki._utils.Missing object>, sticker_ids: list[int] = <mizuki._utils.Missing object>, flags: MessageFlags = <mizuki._utils.Missing object>) Message#
Creates a new message in the specified channel.
Note
At least one of,
content,embeds,sticker_ids,filesmust be provided. For forwarding, onlymessage_referencemust be provided.- Parameters:
content (
str) – The content of the message.tts (
bool) – Whether TTS is enabled for the message.embeds (list[
Embed]) – The list of embeds to send along the message.allowed_mentions (
AllowedMentions) – The AllowedMentions object that dictates whether user, role or everyone pings are enabled.files (list[
File]) – The files to upload with the message.message_reference (
MessageReference) – The reference message for the new message, if anysticker_ids (list[
int]) – The Guild Stickers to send with the message. Max 3.flags (
MessageFlags) – The MessageFlags of the new message.
- Raises:
NotFound – The channel you tried to send to doesn’t exist.
Forbidden – You are not allowed to send the message. You may be missing a specific permission.
HTTPException – A HTTP error occurred.
- type: ChannelType#
The type of this Channel.
- parent_id: Snowflake | None#
The ID of the category (channel of
GUILD_CATEGORY), if any.
- topic: str | None#
The topic of the channel. 0-4096 character limit for
GUILD_FORUMandGUILD_MEDIA, 0-1024 for all others.
- class PartialThreadChannel(data: PartialThreadPayload, guild_id: int | None = None, *, state: ConnectionState)#
Bases:
BasePublicChannelRepresents a Thread Channel in a Guild.
Channel Types#
- flags: ChannelFlags#
The flags of the Channel.
- last_message_id: Snowflake | None#
The ID of the last message (or
ThreadforGUILD_FORUMandGUILD_MEDIA) that was sent in that channel. May or may not point to a valid message.
- last_pin_timestamp: datetime | None#
The timestamp when the last pinned message was pinned. May be
Noneif no messages are pinned.
- parent_id#
- permissions: Permissions | None#
Computed permissions for the invoking user in the channel, including overwrites, only included when part of the
Resolved Datareceived on anInteraction. This does not include implicit permissions, which may need to be checked separately
- rate_limit_per_user: int | None#
The amount of time an user has to wait before sending a message (Slowmode). Bots remain unaffected.
- async send(content: str = <mizuki._utils.Missing object>, *, tts: bool = <mizuki._utils.Missing object>, embeds: list[Embed] = <mizuki._utils.Missing object>, allowed_mentions: AllowedMentions = <mizuki._utils.Missing object>, message_reference: MessageReference = <mizuki._utils.Missing object>, files: list[File] = <mizuki._utils.Missing object>, sticker_ids: list[int] = <mizuki._utils.Missing object>, flags: MessageFlags = <mizuki._utils.Missing object>) Message#
Creates a new message in the specified channel.
Note
At least one of,
content,embeds,sticker_ids,filesmust be provided. For forwarding, onlymessage_referencemust be provided.- Parameters:
content (
str) – The content of the message.tts (
bool) – Whether TTS is enabled for the message.embeds (list[
Embed]) – The list of embeds to send along the message.allowed_mentions (
AllowedMentions) – The AllowedMentions object that dictates whether user, role or everyone pings are enabled.files (list[
File]) – The files to upload with the message.message_reference (
MessageReference) – The reference message for the new message, if anysticker_ids (list[
int]) – The Guild Stickers to send with the message. Max 3.flags (
MessageFlags) – The MessageFlags of the new message.
- Raises:
NotFound – The channel you tried to send to doesn’t exist.
Forbidden – You are not allowed to send the message. You may be missing a specific permission.
HTTPException – A HTTP error occurred.
- type: ChannelType#
The type of this channel.
- thread_metadata: ThreadMetaData#
Metadata of the thread.
- class ChannelMention(data: ChannelMentionPayload)#
Bases:
objectRepresents a minimal channel object for
Message.mention_channels.- type: ChannelType#
The type of the channel.
- type Channel = ThreadChannel | PrivateChannel | GuildChannel#
This is only a type hint for all channel types, not an object.