Channel

discord_http.channel module

class discord_http.channel.BaseChannel(*, state, data, guild_id=None)

Bases: PartialChannel

Represents a base channel object.

Parameters:
name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

topic: str | None

The topic of the channel.

position: int | None

The position of the channel in the guild.

last_message_id: int | None

The ID of the last message in the channel.

parent_id: int | None

The ID of the parent channel (if any).

rate_limit_per_user: int

The rate limit per user in seconds.

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

property flags: ChannelFlags

The flags of the channel.

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

property mention: str

The channel’s mention.

property type: ChannelType

The channel’s type.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

async join_thread() → None

Make the bot join a thread.

Return type:

None

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.CategoryChannel(*, state, data)

Bases: BaseChannel

Represents a category channel.

Parameters:
property type: ChannelType

The channel’s type.

property channels: list[BaseChannel | PartialChannel]

A list of channels in this category.

This will only return channels that are in the same guild as the category.

async create_text_channel(name, **kwargs) → TextChannel

Create a text channel in the category.

Parameters:
  • name (str) – The name of the channel

  • topic – The topic of the channel

  • rate_limit_per_user – The rate limit per user of the channel

  • overwrites – The permission overwrites of the category

  • parent_id – The Category ID where the channel will be placed

  • nsfw – Whether the channel is NSFW or not

  • reason – The reason for creating the text channel

  • **kwargs – Keyword arguments to pass to the channel, look above

Return type:

TextChannel

Returns:

The channel object

async create_voice_channel(name, **kwargs) → VoiceChannel

Create a voice channel to category.

Parameters:
  • name (str) – The name of the channel

  • bitrate – The bitrate of the channel

  • user_limit – The user limit of the channel

  • rate_limit_per_user – The rate limit per user of the channel

  • overwrites – The permission overwrites of the category

  • position – The position of the channel

  • parent_id – The Category ID where the channel will be placed

  • nsfw – Whether the channel is NSFW or not

  • reason – The reason for creating the voice channel

  • **kwargs – Keyword arguments to pass to the channel, look above

Return type:

VoiceChannel

Returns:

The channel object

async create_stage_channel(name, **kwargs) → StageChannel

Create a stage channel.

Parameters:
  • name (str) – The name of the channel

  • bitrate – The bitrate of the channel

  • user_limit – The user limit of the channel

  • overwrites – The permission overwrites of the category

  • position – The position of the channel

  • video_quality_mode – The video quality mode of the channel

  • parent_id – The Category ID where the channel will be placed

  • reason – The reason for creating the stage channel

  • **kwargs – Keyword arguments to pass to the channel, look above

Return type:

StageChannel

Returns:

The created channel

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.DMChannel(*, state, data)

Bases: BaseChannel

Represents a Direct Message channel.

Parameters:
name: str | None

The name of the channel (usually the user’s name).

user: User | None

The user in the DM channel.

last_pin_timestamp: datetime | None

The time of the last pinned message in the DM channel, if any.

property last_message: PartialMessage | None

The last message in the DM channel, if any.

property type: ChannelType

The channel’s type.

property mention: str

The channel’s mention.

async edit(*args, **kwargs) → None

Only here to prevent errors.

Raises:

TypeError – If you try to edit a DM channel

Return type:

None

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.DirectoryChannel(*, state, data)

Bases: BaseChannel

Represents a directory channel.

Parameters:
property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.ForumChannel(state, data)

Bases: PublicThread

Represents a forum channel object.

Parameters:
default_reaction_emoji: EmojiParser | None

The default reaction emoji for the forum channel.

default_auto_archive_duration: int | None

The default auto archive duration in minutes for newly created threads, if set.

default_thread_rate_limit_per_user: int

The initial rate limit per user in seconds for newly created threads.

default_sort_order: SortOrderType | None

The default sort order of posts, None if not set by a channel admin.

default_forum_layout: ForumLayoutType

The default layout used to display posts.

property type: ChannelType

The channel’s type.

property tags: list[ForumTag]

The available tags for the forum channel.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

applied_tags: tuple[int, ...]

The IDs of the tags applied to the thread, only for forum and media threads.

property archive_timestamp: datetime | None

The time the thread’s archive status was last changed.

archived: bool

Whether the thread is archived.

auto_archive_duration: int

The duration in minutes to automatically archive the thread after recent activity.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

property channel_id: int

The ID of the channel (alias of id).

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

property create_timestamp: datetime | None

The time the thread was created, only available for threads created after 2022-01-09.

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

A partial guild object.

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

invitable: bool

Whether non-moderators can add other non-moderators to the thread, only for private threads.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

A partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

locked: bool

Whether the thread is locked.

member_count: int

The number of members in the thread.

property mention: str

The channel’s mention.

message_count: int

The number of messages in the thread.

name: str

The name of the thread.

newly_created: bool

Whether the thread was newly created.

nsfw: bool

Whether the channel is NSFW.

property owner: PartialUser | None

A partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

total_message_sent: int

The total number of messages sent in the thread.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.ForumTag(*, data)

Bases: object

Represents a forum tag object.

Parameters:

data (dict)

id: int | None

The ID of the tag.

name: str

The name of the tag.

moderated: bool

Whether the tag is moderated.

emoji_id: int | None

The emoji ID of the tag.

emoji_name: str | None

The emoji name of the tag.

classmethod create(name=None, *, emoji_id=None, emoji_name=None, moderated=False) → ForumTag

Create a forum tag, used for editing available_tags.

Parameters:
  • name (str | None) – The name of the tag

  • emoji_id (int | None) – The emoji ID of the tag

  • emoji_name (str | None) – The emoji name of the tag

  • moderated (bool) – If the tag is moderated

Return type:

ForumTag

Returns:

The tag object

to_dict() → dict

The forum tag as a dictionary.

Return type:

dict

classmethod from_data(*, data) → Self

Create a forum tag from a dictionary.

Parameters:

data (dict) – The dictionary to create the forum tag from

Return type:

Self

Returns:

The forum tag

class discord_http.channel.ForumThread(state, data)

Bases: PublicThread

Represents a thread in a forum channel.

Parameters:
property type: ChannelType

The channel’s type.

message
async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

applied_tags: tuple[int, ...]

The IDs of the tags applied to the thread, only for forum and media threads.

property archive_timestamp: datetime | None

The time the thread’s archive status was last changed.

archived: bool

Whether the thread is archived.

auto_archive_duration: int

The duration in minutes to automatically archive the thread after recent activity.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

property channel_id: int

The ID of the channel (alias of id).

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

property create_timestamp: datetime | None

The time the thread was created, only available for threads created after 2022-01-09.

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

A partial guild object.

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

invitable: bool

Whether non-moderators can add other non-moderators to the thread, only for private threads.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

A partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

locked: bool

Whether the thread is locked.

member_count: int

The number of members in the thread.

property mention: str

The channel’s mention.

message_count: int

The number of messages in the thread.

name: str

The name of the thread.

newly_created: bool

Whether the thread was newly created.

nsfw: bool

Whether the channel is NSFW.

property owner: PartialUser | None

A partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

total_message_sent: int

The total number of messages sent in the thread.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.GroupDMChannel(*, state, data)

Bases: BaseChannel

Represents a group DM channel.

Parameters:
application_id: int | None

The ID of the application that created the group DM, if any.

property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.NewsChannel(state, data)

Bases: BaseChannel

Represents a news channel.

Parameters:
property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.NewsThread(state, data)

Bases: PublicThread

Represents a news thread.

Parameters:
property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

applied_tags: tuple[int, ...]

The IDs of the tags applied to the thread, only for forum and media threads.

property archive_timestamp: datetime | None

The time the thread’s archive status was last changed.

archived: bool

Whether the thread is archived.

auto_archive_duration: int

The duration in minutes to automatically archive the thread after recent activity.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

property channel_id: int

The ID of the channel (alias of id).

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

property create_timestamp: datetime | None

The time the thread was created, only available for threads created after 2022-01-09.

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

A partial guild object.

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

invitable: bool

Whether non-moderators can add other non-moderators to the thread, only for private threads.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

A partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

locked: bool

Whether the thread is locked.

member_count: int

The number of members in the thread.

property mention: str

The channel’s mention.

message_count: int

The number of messages in the thread.

name: str

The name of the thread.

newly_created: bool

Whether the thread was newly created.

nsfw: bool

Whether the channel is NSFW.

property owner: PartialUser | None

A partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

total_message_sent: int

The total number of messages sent in the thread.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.PartialChannel(*, state, id, guild_id=None, parent_id=None)

Bases: PartialBase

Represents a partial channel object.

Parameters:
guild_id: int | None

The ID of the guild the channel belongs to, if any.

parent_id: int | None

The ID of the parent channel or category, if any.

property type: ChannelType

The channel’s type.

property mention: str

The channel’s mention.

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

However since this is Partial, it will always return Permissions.none()

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

async join_thread() → None

Make the bot join a thread.

Return type:

None

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property created_at: datetime

The datetime of the snowflake.

id: int

The ID of the snowflake.

class discord_http.channel.PartialThread(*, state, id, guild_id, parent_id, type)

Bases: PartialChannel

Represents a partial thread channel object.

Parameters:
parent_id: int

The ID of the parent channel.

property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

async join_thread() → None

Make the bot join a thread.

Return type:

None

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

However since this is Partial, it will always return Permissions.none()

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.PrivateThread(*, state, data)

Bases: PublicThread

Represents a private thread.

Parameters:
property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

applied_tags: tuple[int, ...]

The IDs of the tags applied to the thread, only for forum and media threads.

property archive_timestamp: datetime | None

The time the thread’s archive status was last changed.

archived: bool

Whether the thread is archived.

auto_archive_duration: int

The duration in minutes to automatically archive the thread after recent activity.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

property channel_id: int

The ID of the channel (alias of id).

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

property create_timestamp: datetime | None

The time the thread was created, only available for threads created after 2022-01-09.

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

A partial guild object.

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

invitable: bool

Whether non-moderators can add other non-moderators to the thread, only for private threads.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

A partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

locked: bool

Whether the thread is locked.

member_count: int

The number of members in the thread.

property mention: str

The channel’s mention.

message_count: int

The number of messages in the thread.

name: str

The name of the thread.

newly_created: bool

Whether the thread was newly created.

nsfw: bool

Whether the channel is NSFW.

property owner: PartialUser | None

A partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

total_message_sent: int

The total number of messages sent in the thread.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.PublicThread(*, state, data)

Bases: BaseChannel

Represents a public thread channel object.

Parameters:
name: str

The name of the thread.

message_count: int

The number of messages in the thread.

member_count: int

The number of members in the thread.

total_message_sent: int

The total number of messages sent in the thread.

locked: bool

Whether the thread is locked.

archived: bool

Whether the thread is archived.

auto_archive_duration: int

The duration in minutes to automatically archive the thread after recent activity.

invitable: bool

Whether non-moderators can add other non-moderators to the thread, only for private threads.

applied_tags: tuple[int, ...]

The IDs of the tags applied to the thread, only for forum and media threads.

newly_created: bool

Whether the thread was newly created.

owner_id: int | None

The ID of the user who owns the thread.

property archive_timestamp: datetime | None

The time the thread’s archive status was last changed.

property create_timestamp: datetime | None

The time the thread was created, only available for threads created after 2022-01-09.

property type: ChannelType

The channel’s type.

property channel_id: int

The ID of the channel (alias of id).

property guild: Guild | PartialGuild | None

A partial guild object.

property owner: PartialUser | None

A partial user object.

property last_message: PartialMessage | None

A partial message object if the last message ID is available.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.StageChannel(*, state, data)

Bases: VoiceChannel

Represents a stage channel object.

Parameters:
async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

bitrate: int

The bitrate of the voice channel in bits per second.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

rtc_region: str | None

The RTC region of the voice channel, if set.

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

async set_voice_status(status, *, reason=None) → None

Set the status of the voice channel.

Requires the SET_VOICE_CHANNEL_STATUS permission. If the bot is not connected to the voice channel, MANAGE_CHANNELS is also required.

Parameters:
  • status (str | None) – The new status of the voice channel, up to 500 characters. Use None to clear it.

  • reason (str | None) – The reason for setting the voice channel status

Raises:

ValueError – The status exceeds 500 characters

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

user_limit: int

The user limit of the voice channel.

video_quality_mode: VideoQualityType

The camera video quality mode of the voice channel.

property type: ChannelType

The channel’s type.

property stage_instance: StageInstance | None

The stage instance for this channel, if available and cached.

async fetch_stage_instance() → StageInstance

Fetch the stage instance associated with this stage channel.

Return type:

StageInstance

async create_stage_instance(*, topic, privacy_level=<MISSING>, send_start_notification=<MISSING>, guild_scheduled_event=<MISSING>, reason=None) → StageInstance

Create a stage instance.

Parameters:
  • topic (str) – The topic of the stage instance

  • privacy_level (PrivacyLevelType) – The privacy level of the stage instance. Defaults to PrivacyLevelType.guild_only

  • send_start_notification (bool) – Whether to notify @everyone that the stage instance has started.

  • guild_scheduled_event (Snowflake | int) – The guild scheduled event to associate with this stage instance.

  • reason (str | None) – The reason for creating the stage instance

Return type:

StageInstance

Returns:

The created stage instance

class discord_http.channel.StageInstance(*, state, data) → None

Bases: PartialBase

Represents a stage instance for a stage channel.

This holds information about a live stage.

Parameters:
property created_at: datetime

The datetime of the snowflake.

id: int

The ID of the snowflake.

channel_id: int

The ID of the stage channel.

guild_id: int

The associated guild ID of the stage channel.

topic: str

The topic of the stage instance.

privacy_level: PrivacyLevelType

The privacy level of the stage instance.

guild_scheduled_event_id: int | None

The guild scheduled event ID associated with this stage instance.

property guild: Guild | PartialGuild | None

The guild this stage instance belongs to, or None if unknown.

property channel: PartialChannel | StageChannel

The stage channel this instance is associated with.

property scheduled_event: PartialScheduledEvent | None

The scheduled event linked to this stage instance, if any.

async edit(*, topic=<MISSING>, privacy_level=<MISSING>, reason=None) → Self

Edit this stage instance.

Parameters:
  • topic (str) – The new topic of this stage instance.

  • privacy_level (PrivacyLevelType) – The new privacy level of this stage instance.

  • reason (str | None) – The reason for editing the stage instance.

Return type:

Self

Returns:

The edited stage instance

async delete(*, reason=None) → None

Delete this stage instance.

Parameters:

reason (str | None) – The reason for deleting the stage instance

Return type:

None

class discord_http.channel.StoreChannel(*, state, data)

Bases: BaseChannel

Represents a store channel.

Parameters:
property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.TextChannel(*, state, data)

Bases: BaseChannel

Represents a text channel.

Parameters:
default_auto_archive_duration: int | None

The default auto archive duration in minutes for newly created threads, if set.

default_thread_rate_limit_per_user: int

The initial rate limit per user in seconds for newly created threads.

property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.Thread(*, state, data)

Bases: PublicThread

Represents a thread channel.

Parameters:
property type: ChannelType

The channel’s type.

async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

applied_tags: tuple[int, ...]

The IDs of the tags applied to the thread, only for forum and media threads.

property archive_timestamp: datetime | None

The time the thread’s archive status was last changed.

archived: bool

Whether the thread is archived.

auto_archive_duration: int

The duration in minutes to automatically archive the thread after recent activity.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

property channel_id: int

The ID of the channel (alias of id).

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

property create_timestamp: datetime | None

The time the thread was created, only available for threads created after 2022-01-09.

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

A partial guild object.

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

invitable: bool

Whether non-moderators can add other non-moderators to the thread, only for private threads.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

A partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

locked: bool

Whether the thread is locked.

member_count: int

The number of members in the thread.

property mention: str

The channel’s mention.

message_count: int

The number of messages in the thread.

name: str

The name of the thread.

newly_created: bool

Whether the thread was newly created.

nsfw: bool

Whether the channel is NSFW.

property owner: PartialUser | None

A partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

total_message_sent: int

The total number of messages sent in the thread.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

class discord_http.channel.Typing(*, state, channel)

Bases: object

Helper class for the typing indicator.

Parameters:
task: Task | None

The task for the typing loop, if using async with.

loop: AbstractEventLoop

The event loop to use for the typing indicator.

channel: PartialChannel

The channel the typing indicator is for.

async do_typing_loop() → None

Continuously sends the typing indicator every 8 seconds until cancelled.

Return type:

None

class discord_http.channel.VoiceChannel(*, state, data)

Bases: BaseChannel

Represents a voice channel object.

Parameters:
async add_thread_member(user_id) → None

Add a thread member.

Parameters:

user_id (int) – The user ID to add

Return type:

None

property app_permissions: Permissions | None

The bot’s permissions in this channel, only available on resolved channels from an interaction.

async bulk_delete_messages(*, check=None, before=None, after=None, around=None, message_ids=None, limit=100, reason=None, return_messages=False) → list[Message] | int

Deletes messages in bulk.

Parameters:
Return type:

list[Message] | int

Returns:

Returns a list of messages deleted if return_messages is True, otherwise returns the count of deleted messages.

property channel: BaseChannel | CategoryChannel | PartialChannel | None

The channel the thread is in.

Only returns a full object if cache is enabled for guild and channel.

async create_forum_or_media(name, *, content=None, embed=None, embeds=None, file=None, files=None, allowed_mentions=None, view=None, auto_archive_duration=4320, rate_limit_per_user=None, flags=None, applied_tags=None, stickers=None, reason=None) → ForumThread

Create a forum or media thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • content (str | None) – The content of the message

  • embed (Embed | None) – Embed to be sent

  • embeds (list[Embed] | None) – List of embeds to be sent

  • file (File | None) – File to be sent

  • files (list[File] | None) – List of files to be sent

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • view (View | None) – The view to be sent

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • rate_limit_per_user (int | None) – How long the slowdown should be

  • flags (MessageFlags | None) – Flags of the message

  • applied_tags (list[ForumTag | int] | None) – The tags to be applied to the thread

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • reason (str | None) – The reason for creating the thread

Return type:

ForumThread

Returns:

The created thread

async create_invite(*, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, user_ids=None, role_ids=None, reason=None) → Invite

Create an invite for the channel.

Parameters:
  • max_age (timedelta | int) – How long the invite should last

  • max_uses (int | None) – The maximum amount of uses for the invite

  • temporary (bool) – If the invite should be temporary

  • unique (bool) – If the invite should be unique

  • target_type (InviteTargetType | int | None) – The type of target for this voice channel invite

  • target_user_id (Snowflake | int | None) – The ID of the user whose stream to display for this invite. (Requiresd if target_type is InviteTargetType.stream)

  • target_application_id (Snowflake | int | None) – The ID of the embedded application to open for this invite. (Requiresd if target_type is InviteTargetType.embedded_application)

  • user_ids (list[Snowflake | int] | None) – The users to be able to use this invite. Any users not in this list, will see the invite as “invalid”. Up to 1000 users are sent directly, anything above is uploaded as a CSV file and processed in the background by Discord.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this invite

  • reason (str | None) – The reason for creating the invite

Return type:

Invite

Returns:

The invite object

async create_thread(name, *, type=ChannelType.guild_private_thread, auto_archive_duration=4320, invitable=True, rate_limit_per_user=None, reason=None) → PublicThread | PrivateThread | NewsThread

Creates a thread in the channel.

Parameters:
  • name (str) – The name of the thread

  • type (ChannelType | int) – The type of thread to create

  • auto_archive_duration (int | None) – The duration in minutes to automatically archive the thread after recent activity

  • invitable (bool) – If the thread is invitable

  • rate_limit_per_user (timedelta | int | None) – How long the slowdown should be

  • reason (str | None) – The reason for creating the thread

Return type:

PublicThread | PrivateThread | NewsThread

Returns:

The thread object

Raises:

ValueError –

  • If the auto_archive_duration is not 60, 1440, 4320 or 10080 - If the rate_limit_per_user is not between 0 and 21600 seconds

async create_webhook(name, *, avatar=None, reason=None) → Webhook

Create a webhook for the channel.

Parameters:
  • name (str) – The name of the webhook

  • avatar (File | bytes | None) – The avatar of the webhook

  • reason (str | None) – The reason for creating the webhook that appears in audit logs

Return type:

Webhook

Returns:

The webhook object

property created_at: datetime

The datetime of the snowflake.

async delete(*, reason=None) → None

Delete the channel.

Parameters:

reason (str | None) – The reason for deleting the channel

Return type:

None

async delete_permission(id, *, reason=None) → None

Delete a permission overwrite for the channel.

Parameters:
  • id (Snowflake | int) – The ID of the overwrite

  • reason (str | None) – The reason for deleting the overwrite

Return type:

None

async edit(*, name=<MISSING>, type=<MISSING>, position=<MISSING>, topic=<MISSING>, nsfw=<MISSING>, rate_limit_per_user=<MISSING>, bitrate=<MISSING>, user_limit=<MISSING>, overwrites=<MISSING>, parent_id=<MISSING>, rtc_region=<MISSING>, video_quality_mode=<MISSING>, default_auto_archive_duration=<MISSING>, flags=<MISSING>, available_tags=<MISSING>, default_reaction_emoji=<MISSING>, default_thread_rate_limit_per_user=<MISSING>, default_sort_order=<MISSING>, default_forum_layout=<MISSING>, archived=<MISSING>, auto_archive_duration=<MISSING>, locked=<MISSING>, invitable=<MISSING>, applied_tags=<MISSING>, reason=None) → BaseChannel

Edit the channel.

Note that this method globaly edits any channel type. So be sure to use the correct parameters for the channel.

Parameters:
  • name (str | None) – New name of the channel (All)

  • type (ChannelType | int | None) – The new type of the channel (Text, Announcement)

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

  • topic (str | None) – The new topic of the channel (Text, Announcement, Forum, Media)

  • nsfw (bool | None) – If the channel should be NSFW (Text, Voice, Announcement, Stage, Forum, Media)

  • rate_limit_per_user (int | None) – How long the slowdown should be (Text, Voice, Stage, Forum, Media)

  • bitrate (int | None) – The new bitrate of the channel (Voice, Stage)

  • user_limit (int | None) – The new user limit of the channel (Voice, Stage)

  • overwrites (list[PermissionOverwrite] | None) – The new permission overwrites of the channel (All)

  • parent_id (Snowflake | int | None) – The new parent ID of the channel (Text, Voice, Announcement, Stage, Forum, Media)

  • rtc_region (str | None) – The new RTC region of the channel (Voice, Stage)

  • video_quality_mode (VideoQualityType | int | None) – The new video quality mode of the channel (Voice, Stage)

  • default_auto_archive_duration (int | None) – The new default auto archive duration of the channel (Text, Announcement, Forum, Media)

  • flags (ChannelFlags | None) – The new flags of the channel (Forum, Media)

  • available_tags (list[ForumTag] | None) – The new available tags of the channel (Forum, Media)

  • default_reaction_emoji (str | None) – The new default reaction emoji of the channel (Forum, Media)

  • default_thread_rate_limit_per_user (int | None) – The new default thread rate limit per user of the channel (Text, Forum, Media)

  • default_sort_order (SortOrderType | int | None) – The new default sort order of the channel (Forum, Media)

  • default_forum_layout (ForumLayoutType | int | None) – The new default forum layout of the channel (Forum)

  • archived (bool | None) – If the thread should be archived (Thread, Forum)

  • auto_archive_duration (int | None) – The new auto archive duration of the thread (Thread, Forum)

  • locked (bool | None) – If the thread should be locked (Thread, Forum)

  • invitable (bool | None) – If the thread should be invitable by everyone (Thread)

  • applied_tags (list[ForumTag | int] | None) – The new applied tags of the forum thread (Forum, Media)

  • reason (str | None) – The reason for editing the channel (All)

Return type:

BaseChannel

Returns:

The channel object

async fetch() → BaseChannel

Fetches the channel and returns the channel object.

Return type:

BaseChannel

async fetch_archived_private_threads(*, client=False, before=None, limit=None) → list[PrivateThread]

Fetch all archived private threads.

Parameters:
  • client (bool) – If it should fetch only where the client is a member of the thread

  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads(*, before=None, limit=None) → list[PublicThread]

Fetch all archived public threads.

Parameters:
  • before (datetime | None) – Only fetch threads archived before this time

  • limit (int | None) – The maximum amount of threads to fetch

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_history(*, before=None, after=None, around=None, limit=100, oldest_first=False) → AsyncIterator[Message]

Fetch the channel’s message history.

Parameters:
Yields:

The message object

Return type:

AsyncIterator[Message]

async fetch_invites() → list[Invite]

Fetch all the invites for the channel.

Return type:

list[Invite]

async fetch_message(message_id) → Message

Fetch a message from the channel.

Parameters:

message_id (int) – The message ID to fetch

Return type:

Message

Returns:

The message object

async fetch_pins(*, before=None, limit=50) → AsyncIterator[MessagePin]

Fetch the pinned messages for the channel in question, newest pin first.

Parameters:
  • before (datetime | None) – Get messages pinned before this timestamp

  • limit (int | None) – The maximum amount of pins to fetch. None will fetch all pins.

Yields:

The pinned message, along with when it was pinned

Return type:

AsyncIterator[MessagePin]

async fetch_thread_member(user_id) → ThreadMember

Fetch a thread member.

Parameters:

user_id (int) – The user ID to fetch

Return type:

ThreadMember

Returns:

The thread member object

async fetch_thread_members(*, after=None, limit=100) → list[ThreadMember]

Fetch thread members.

Parameters:
  • after (Snowflake | int | None) – Only fetch thread members after this user ID

  • limit (int) – The maximum amount of thread members to fetch (1-100)

Return type:

list[ThreadMember]

Returns:

The list of thread members

property flags: ChannelFlags

The flags of the channel.

async follow_announcement_channel(source_channel_id, *, reason=None) → PartialWebhook

Follow an announcement channel to send messages to the webhook.

Parameters:
  • source_channel_id (Snowflake | int) – The channel ID to follow

  • reason (str | None) – The reason for following the announcement channel

Return type:

PartialWebhook

Returns:

The webhook created in this channel for the followed channel

classmethod from_dict(*, state, data, guild_id=None) → BaseChannel

Create a channel object from a dictionary.

Requires the state to be set

Parameters:
  • state (DiscordAPI) – The state to use

  • data (dict) – Data provided by Discord API

  • guild_id (int | None) – The ID of the guild the channel belongs to, if any

Return type:

BaseChannel

Returns:

The channel object

get_partial_message(message_id) → PartialMessage

Get a partial message object from the channel.

Parameters:

message_id (int) – The message ID to get the partial message from

Return type:

PartialMessage

Returns:

The partial message object

property guild: Guild | PartialGuild | None

The guild the channel belongs to (if available).

If you are using gateway cache, it can return full object too

guild_id: int | None

The ID of the guild the channel belongs to, if any.

id: int

The ID of the snowflake.

is_obfuscated() → bool

Whether this channel’s data is obfuscated because the bot lacks VIEW_CHANNEL access to it.

Obfuscated channels have their name replaced with “___hidden___” and other sensitive fields nulled or reduced. Access is regained the moment the bot’s permissions change, at which point a CHANNEL_UPDATE event delivers full data.

Return type:

bool

is_spoiler() → bool

If a channel is marked as fulyl spoiler or not.

Return type:

bool

async join_thread() → None

Make the bot join a thread.

Return type:

None

last_message_id: int | None

The ID of the last message in the channel.

async leave_thread() → None

Make the bot leave a thread.

Return type:

None

property mention: str

The channel’s mention.

name: str | None

The name of the channel.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

The parent channel of the thread or the parent category of the channel.

Only returns a full object if cache is enabled for guild and channel.

parent_id: int | None

The ID of the parent channel (if any).

property permission_overwrites: list[PermissionOverwrite]

Shows the permission overwrites for the channel.

permissions_for(member) → Permissions

Returns the permissions for a member in the channel.

Note that this only works if you are using Gateway with guild, role and channel cache.

Parameters:

member (Member) – The member to get the permissions for.

Return type:

Permissions

Returns:

The permissions for the member in the channel.

position: int | None

The position of the channel in the guild.

rate_limit_per_user: int

The rate limit per user in seconds.

async remove_thread_member(user_id) → None

Remove a thread member.

Parameters:

user_id (int) – The user ID to remove

Return type:

None

async send(content=<MISSING>, *, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, poll=<MISSING>, flags=<MISSING>, allowed_mentions=<MISSING>, stickers=<MISSING>, nonce=<MISSING>, enforce_nonce=False, shared_client_theme=<MISSING>, delete_after=None) → Message

Send a message to the channel.

Parameters:
  • content (str | None) – Cotnent of the message

  • embed (Embed | None) – Includes an embed object

  • embeds (list[Embed] | None) – List of embed objects

  • file (File | None) – A file object

  • files (list[File] | None) – A list of file objects

  • view (View | None) – Send components to the message

  • tts (bool | None) – If the message should be sent as a TTS message

  • type (ResponseType | int) – The type of response to the message

  • allowed_mentions (AllowedMentions | None) – The allowed mentions for the message

  • poll (Poll | None) – The poll to be sent

  • flags (MessageFlags | None) – Flags of the message

  • stickers (list[PartialSticker | Snowflake | int] | None) – Stickers from the guild to send with the message, max 3

  • nonce (int | str | None) – Nonce to verify the message was sent, max 25 characters

  • enforce_nonce (bool) – Whether the nonce should be enforced, returning the existing message if it was already sent

  • shared_client_theme (SharedClientTheme | None) – Client theme to share with the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message object

async set_permission(overwrite, *, reason=None) → None

Set a permission overwrite for the channel.

Parameters:
  • overwrite (PermissionOverwrite) – The new overwrite permissions for the spesific role/user

  • reason (str | None) – The reason for editing the overwrite

Return type:

None

topic: str | None

The topic of the channel.

typing() → Typing

Makes the bot trigger the typing indicator.

There are two ways you can use this: - Usual await call - Using async with to type as long as you need

# Method 1
await channel.typing()  # Stops after 10 seconds or message sent

# Method 2
async with channel.typing():
    asyncio.sleep(4)
Return type:

Typing

bitrate: int

The bitrate of the voice channel in bits per second.

user_limit: int

The user limit of the voice channel.

rtc_region: str | None

The RTC region of the voice channel, if set.

video_quality_mode: VideoQualityType

The camera video quality mode of the voice channel.

property type: ChannelType

The channel’s type.

async set_voice_status(status, *, reason=None) → None

Set the status of the voice channel.

Requires the SET_VOICE_CHANNEL_STATUS permission. If the bot is not connected to the voice channel, MANAGE_CHANNELS is also required.

Parameters:
  • status (str | None) – The new status of the voice channel, up to 500 characters. Use None to clear it.

  • reason (str | None) – The reason for setting the voice channel status

Raises:

ValueError – The status exceeds 500 characters

Return type:

None

class discord_http.channel.VoiceRegion(*, data)

Bases: object

Represents a voice region object.

Parameters:

data (dict)

id: str

The ID of the voice region.

name: str

The name of the voice region.

custom: bool

Whether the voice region is custom.

deprecated: bool

Whether the voice region is deprecated.

optimal: bool

Whether the voice region is optimal for the current user.