Channels#

Manager#

class ChannelManager(state: ConnectionState, cache: CacheStorage)#

Bases: BaseManager

Manager used to fetch Channel objects.

get(channel_id: int) Channel | None#

Attempts to fetch a Channel from the internal cache of the bot.

Parameters:

channel_id (int) – The channel_id of the channel to fetch.

Returns:

  • Channel – The Channel object recieved from the cache.

  • None – The Channel could not be found in the cache.

async fetch(channel_id: int) Channel#

Attempts to fetch a Channel from 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 Channel from 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_CHANNELS for a guild channel or MANAGE_THREADS for a thread. Additionally, requires MANAGE_ROLES if modifying the permissions.

Note

All parameters besides channel_id are 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 a GUILD_TEXT channel and a GUILD_ANNOUNCEMENT channel is supported.

  • position (int | None) – The position of the channel.

  • topic (str | None) – The topic of the channel. 0-4096 character limit for GUILD_FORUM and GUILD_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 when None is 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 a GUILD_FORUM and GUILD_MEDIA channel. 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 a GUILD_FORUM and GUILD_MEDIA channel.

  • default_forum_layout (ForumLayoutType) – The default forum layout used in GUILD_FORUM channel.

  • 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 a GUILD_FORUM and GUILD_MEDIA channel. 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, requires MANAGE_ROLES if modifying the permissions.

Note

All parameters besides channel_id are 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 a GUILD_TEXT channel and a GUILD_ANNOUNCEMENT channel is supported.

  • position (int | None) – The position of the channel.

  • topic (str | None) – The topic of the channel. 0-4096 character limit for GUILD_FORUM and GUILD_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 when None is 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 the REQUIRE_TAG is added to the flags.

  • hide_media_download_options (bool) – Whether the HIDE_MEDIA_DOWNLOAD_OPTIONS is added to the flags.

  • available_tags (list[PartialForumTag]) – The set of tags that can be used in a GUILD_FORUM and GUILD_MEDIA channel. 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 a GUILD_FORUM and GUILD_MEDIA channel.

  • default_forum_layout (ForumLayoutType) – The default forum layout used in GUILD_FORUM channel.

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_id are 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.

  • pinned (bool) – Whether the PINNED is added to the flags.

  • applied_tags (list[int]) – The IDs of tags applied to a thread in a GUILD_FORUM and GUILD_MEDIA channel. Max 5.

Raises:
async set_voice_status(channel_id: int, *, status: str | None) None#

Set a voice channel’s status.

Requires the SET_VOICE_CHANNEL_STATUS permission, and additionally the MANAGE_CHANNELS permission if the current user is not connected to the voice channel.

Parameters:
  • channel_id (int) – The ID of the voice channel.

  • 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(channel_id: int) Channel#

Deletes a channel or closes a private channel.

Requires the MANAGE_CHANNELS for a guild channel or MANAGE_THREADS for 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:
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: object

Represents the metadata of a thread.

archived: bool#

Represents if the thread is archived.

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

locked: bool#

Represents if the thread is locked.

invitable: bool#

Whether non-moderators can add other non-moderators to a thread, only available on Private Threads.

create_timestamp: datetime | None#

Represents when the thread was created. Will be None for threads older than 2022-01-09.

class ThreadMember(data: ThreadMemberPayload, guild_id: int | None = None, user_id: int | None = None, *, state: ConnectionState)#

Bases: object

Represents information about an user that has joined a thread.

id: Snowflake | None#

The ID of the Thread. Omitted in GUILD_CREATE.

user_id: Snowflake | None#

The ID of the User. Omitted in GUILD_CREATE.

join_timestamp: datetime#

Time the user last joined the thread.

notifications: bool#

Represents if the User has notifications enabled.

member: Member | None#

The Member Object for the user in the Guild. Omitted in GUILD_CREATE.

class PartialForumTag(data: PartialForumTagPayload)#

Bases: object

Represents a partial Forum Tag object to be passed for editing the available tags of a channel.

name: str#

The name of the tag. (0-20 characters long)

classmethod new(*, name: str) Self#

Creates a new instance of a partial Forum Tag.

Parameters:

name (str) – The name of the tag.

class ForumTag(data: ForumTagPayload)#

Bases: PartialForumTag

Represents a Forum Tag which can be applied to Channels of types GUILD_FORUM and GUILD_MEDIA.

Note

Atleast one of emoji_id and emoji_name will always be present.

id: Snowflake#

The ID of the Tag.

moderated: bool#

Whether this Tag can only be added to or removed from valid ChannelType by a member with the MANAGE_THREADS permission.

emoji_id: Snowflake | None#

The ID of a Guild’s custom emoji.

emoji_name: str | None#

The unicode character of the emoji.

name: str#

The name of the tag. (0-20 characters long)

classmethod new(*, name: str) Self#

Creates a new instance of a partial Forum Tag.

Parameters:

name (str) – The name of the tag.

class GuildChannel(data: GuildChannelPayload, guild_id: int | None = None, *, state: ConnectionState)#

Bases: BasePublicChannel

Represents 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_FORUM and GUILD_MEDIA, 0-1024 for all others.

default_auto_archive_duration: timedelta | None#

The default amount of time before a newly created thread is 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.

nsfw: bool#

Whether the channel is NSFW.

available_tags: list[ForumTag]#

The list of tags that can be used in GUILD_FORUM and GUILD_MEDIA channels.

default_sort_order: SortOrderType | None#

Default sortorder used when posting in a GUILD_FORUM and GUILD_MEDIA channel. None indicates that the setting hasn’t been set by an admin.

default_forum_layout: ForumLayoutType | None#

The default ForumLayout used to display posts in GUILD_FORUM channels.

bitrate: int | None#

The bitrate in bits/second for a voice channel. (GUILD_VOICE and GUILD_STAGE_VOICE).

user_limit: int | None#

The User Limit for a voice channel. (GUILD_VOICE and GUILD_STAGE_VOICE).

rtc_region: str | None#

The RTC Region ID for a voice channel. (GUILD_VOICE and GUILD_STAGE_VOICE).

video_quality_mode: VideoQualityMode#

The VideoQualityMode of the channel, default AUTO.

property created_at: datetime#

The timestamp at which the Channel was created.

Return type:

datetime

flags: ChannelFlags#

The flags of the Channel.

guild_id: Snowflake#

The Guild ID of the Channel.

id: Snowflake#

The ID of the Channel.

last_message_id: Snowflake | None#

The ID of the last message (or Thread for GUILD_FORUM and GUILD_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 None if no messages are pinned.

name: str#

The name of the channel

permissions: Permissions | None#

Computed permissions for the invoking user in the channel, including overwrites, only included when part of the Resolved Data received on an Interaction. 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, files must be provided. For forwarding, only message_reference must 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 any

  • sticker_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, requires MANAGE_ROLES if 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 a GUILD_TEXT channel and a GUILD_ANNOUNCEMENT channel is supported.

  • position (int | None) – The position of the channel.

  • topic (str | None) – The topic of the channel. 0-4096 character limit for GUILD_FORUM and GUILD_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 when None is 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 the REQUIRE_TAG is added to the flags.

  • hide_media_download_options (bool) – Whether the HIDE_MEDIA_DOWNLOAD_OPTIONS is added to the flags.

  • available_tags (list[PartialForumTag]) – The set of tags that can be used in a GUILD_FORUM and GUILD_MEDIA channel. 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 a GUILD_FORUM and GUILD_MEDIA channel.

  • default_forum_layout (ForumLayoutType) – The default forum layout used in GUILD_FORUM channel.

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_STATUS permission, and additionally the MANAGE_CHANNELS permission 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.

async delete_messages(message_ids: list[int]) None#
class ThreadChannel(data: ThreadPayload, guild_id: int | None = None, *, state: ConnectionState)#

Bases: BasePublicChannel

Represents a Thread Channel in a Guild.

Channel Types#

property created_at: datetime#

The timestamp at which the Channel was created.

Return type:

datetime

flags: ChannelFlags#

The flags of the Channel.

guild_id: Snowflake#

The Guild ID of the Channel.

id: Snowflake#

The ID of the Channel.

last_message_id: Snowflake | None#

The ID of the last message (or Thread for GUILD_FORUM and GUILD_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 None if no messages are pinned.

name: str#

The name of the channel

parent_id#
permissions: Permissions | None#

Computed permissions for the invoking user in the channel, including overwrites, only included when part of the Resolved Data received on an Interaction. 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, files must be provided. For forwarding, only message_reference must 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 any

  • sticker_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.

owner_id: Snowflake#

The owner of this thread.

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.

member_count: int#

The amount of members in this thread. Stops counting at 50.

total_message_sent: int#

The total amount of messages ever sent in this thread.

applied_tags: list[Snowflake]#

The tags applied to a thead in a GUILD_FORUM and GUILD_MEDIA channel.

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.

  • pinned (bool) – Whether the PINNED is added to the flags.

  • applied_tags (list[int]) – The IDs of tags applied to a thread in a GUILD_FORUM and GUILD_MEDIA channel. Max 5.

Raises:
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: BaseChannel

Represents a private (DM) channel.

property created_at: datetime#

The timestamp at which the Channel was created.

Return type:

datetime

flags: ChannelFlags#

The flags of the Channel.

id: Snowflake#

The ID of the Channel.

last_message_id: Snowflake | None#

The ID of the last message (or Thread for GUILD_FORUM and GUILD_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 None if 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, files must be provided. For forwarding, only message_reference must 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 any

  • sticker_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.

recipients: list[User]#

The recipients or the members of the channel.

type: ChannelType#

The ChannelType of this Channel. Always DM.

async close() None#

Closes a private channel.

Raises:
class PartialGuildChannel(data: PartialGuildChannelPayload, guild_id: int | None, *, state: ConnectionState)#

Bases: BasePublicChannel

Represents a Partial Channel/Category in a Guild.

Channel Types#

property created_at: datetime#

The timestamp at which the Channel was created.

Return type:

datetime

flags: ChannelFlags#

The flags of the Channel.

guild_id: Snowflake#

The Guild ID of the Channel.

id: Snowflake#

The ID of the Channel.

last_message_id: Snowflake | None#

The ID of the last message (or Thread for GUILD_FORUM and GUILD_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 None if no messages are pinned.

name: str#

The name of the channel

permissions: Permissions | None#

Computed permissions for the invoking user in the channel, including overwrites, only included when part of the Resolved Data received on an Interaction. 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, files must be provided. For forwarding, only message_reference must 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 any

  • sticker_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_FORUM and GUILD_MEDIA, 0-1024 for all others.

position: int | None#

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

nsfw: bool#

Whether the channel is NSFW.

class PartialThreadChannel(data: PartialThreadPayload, guild_id: int | None = None, *, state: ConnectionState)#

Bases: BasePublicChannel

Represents a Thread Channel in a Guild.

Channel Types#

property created_at: datetime#

The timestamp at which the Channel was created.

Return type:

datetime

flags: ChannelFlags#

The flags of the Channel.

guild_id: Snowflake#

The Guild ID of the Channel.

id: Snowflake#

The ID of the Channel.

last_message_id: Snowflake | None#

The ID of the last message (or Thread for GUILD_FORUM and GUILD_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 None if no messages are pinned.

name: str#

The name of the channel

parent_id#
permissions: Permissions | None#

Computed permissions for the invoking user in the channel, including overwrites, only included when part of the Resolved Data received on an Interaction. 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, files must be provided. For forwarding, only message_reference must 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 any

  • sticker_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: object

Represents a minimal channel object for Message.mention_channels.

id: Snowflake#

The ID of the channel.

guild_id: Snowflake#

The Guild ID of the channel.

type: ChannelType#

The type of the channel.

name: str#

The name of the channel.

type Channel = ThreadChannel | PrivateChannel | GuildChannel#

This is only a type hint for all channel types, not an object.

Enums#

class ChannelType(*values)#
GUILD_TEXT = 0#
DM = 1#
GUILD_VOICE = 2#
GROUP_DM = 3#
GUILD_CATEGORY = 4#
GUILD_ANNOUNCEMENT = 5#
ANNOUNCEMENT_THREAD = 10#
PUBLIC_THREAD = 11#
PRIVATE_THREAD = 12#
GUILD_STAGE_VOICE = 13#
GUILD_DIRECTORY = 14#
GUILD_FORUM = 15#
GUILD_MEDIA = 16#
class ChannelPermissionOverwriteType(*values)#
ROLE = 0#
MEMBER = 1#
class VideoQualityMode(*values)#
AUTO = 1#
FULL = 2#
class SortOrderType(*values)#
LATEST_ACTIVITY = 0#
CREATION_DATE = 1#
class ForumLayoutType(*values)#
NOT_SET = 0#
LIST_VIEW = 1#
GALLERY_VIEW = 2#

Errors#

class UnknownChannelType#

Raised when the channel parser could not parse the channel you received.

add_note(object, /)#

Exception.add_note(note) – add a note to the exception

args#
with_traceback(object, /)#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.