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 mention: str

The channel’s mention.

property type: ChannelType

Returns the channel’s type.

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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

Returns 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>, 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

  • 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

Returns the channel’s type.

property channels: list[BaseChannel | PartialChannel]

Returns 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

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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

  • 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_message: PartialMessage | None

The last message in the DM channel.

property type: ChannelType

Returns 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

last_pin_timestamp
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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

  • 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

Returns 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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

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

property type: ChannelType

Returns 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

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

Returns the channel the thread is in.

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

channel_id: int

The ID of the 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

Returns a partial guild object.

guild_id: int | None

The ID of the guild the thread belongs to.

id: int

The ID of the snowflake.

async join_thread() None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

Returns a partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the thread.

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

Returns a partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

Returns 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>, 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

  • 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

Returns 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

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

Returns the channel the thread is in.

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

channel_id: int

The ID of the 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

Returns a partial guild object.

guild_id: int | None

The ID of the guild the thread belongs to.

id: int

The ID of the snowflake.

async join_thread() None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

Returns a partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the thread.

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

Returns a partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

Returns 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>, 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

  • 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:
property type: ChannelType

Returns 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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

  • 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

Returns 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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

  • 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

Returns 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

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

Returns the channel the thread is in.

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

channel_id: int

The ID of the 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

Returns a partial guild object.

guild_id: int | None

The ID of the guild the thread belongs to.

id: int

The ID of the snowflake.

async join_thread() None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

Returns a partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the thread.

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

Returns a partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

Returns 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>, 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

  • 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)

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

Returns 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

Returns 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

Returns 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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

Return type:

list[PublicThread]

Returns:

The list of public threads

async fetch_archived_private_threads(*, client=False) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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>, 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

  • 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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:

Message – 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() list[ThreadMember]

Fetch all thread members.

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

Returns 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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

Returns 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>, 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

  • 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

Returns 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

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

Returns the channel the thread is in.

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

channel_id: int

The ID of the 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

Returns a partial guild object.

guild_id: int | None

The ID of the guild the thread belongs to.

id: int

The ID of the snowflake.

async join_thread() None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

Returns a partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the thread.

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

Returns a partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

Returns 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>, 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

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

rate_limit_per_user: int

The rate limit per user in seconds.

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.

channel_id: int

The ID of the channel.

newly_created: bool

Whether the thread was newly created.

guild_id: int | None

The ID of the guild the thread belongs to.

owner_id: int | None

The ID of the user who owns the thread.

last_message_id: int | None

The ID of the last message in the thread.

property type: ChannelType

Returns the channel’s type.

property guild: Guild | PartialGuild | None

Returns a partial guild object.

property owner: PartialUser | None

Returns a partial user object.

property last_message: PartialMessage | None

Returns 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

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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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.

nsfw: bool

Whether the channel is NSFW.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

Returns 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.

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>, 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

  • 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

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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

  • 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

user_limit: int

The user limit of the voice channel.

property type: ChannelType

Returns the channel’s type.

property stage_instance: StageInstance | None

Returns 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

Returns:

The stage instance of the channel

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.StoreChannel(*, state, data)

Bases: BaseChannel

Represents a store channel.

Parameters:
property type: ChannelType

Returns 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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

  • 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:
property type: ChannelType

Returns 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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

  • 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

Returns 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

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

Returns the channel the thread is in.

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

channel_id: int

The ID of the 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

Returns a partial guild object.

guild_id: int | None

The ID of the guild the thread belongs to.

id: int

The ID of the snowflake.

async join_thread() None

Make the bot join a thread.

Return type:

None

property last_message: PartialMessage | None

Returns a partial message object if the last message ID is available.

last_message_id: int | None

The ID of the last message in the thread.

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

Returns a partial user object.

owner_id: int | None

The ID of the user who owns the thread.

property parent: BaseChannel | CategoryChannel | PartialChannel | None

Returns 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>, 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

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

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

Returns 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, applied_tags=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

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

Return type:

ForumThread

Returns:

_description_

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) 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”.

  • role_ids (list[Snowflake | int] | None) – The roles to be able to use this 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) list[PrivateThread]

Fetch all archived private threads.

Parameters:

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

Return type:

list[PrivateThread]

Returns:

The list of private threads

async fetch_archived_public_threads() list[PublicThread]

Fetch all archived public threads.

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:

Message – The message object

Return type:

AsyncIterator[Message]

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() list[Message]

Fetch all pinned messages for the channel in question.

Return type:

list[Message]

Returns:

The list of pinned messages

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() list[ThreadMember]

Fetch all thread members.

Return type:

list[ThreadMember]

Returns:

The list of thread members

async follow_announcement_channel(source_channel_id) None

Follow an announcement channel to send messages to the webhook.

Parameters:

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

Return type:

None

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

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

Returns 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>, 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

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

property type: ChannelType

Returns the channel’s type.

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.