Channel
- class discord_limits.paths.ChannelPaths(client)
- Parameters:
client (discord_limits.DiscordClient) – The DiscordClient instance to use.
- async get_channel(channel_id)
Get a channel by ID.
- Parameters:
channel_id (int) – The ID of the channel you wish to get information about.
- Returns:
Channel information.
- Return type:
ClientResponse
- async edit_channel(channel_id, *, reason=None, **options)
Update a channel’s settings.
- Parameters:
channel_id (int) – The ID of the channel you wish to edit.
reason (Optional[str], optional) – A reason for this edit that will be displayed in the audit log, by default None
options (Any) – The params required to update the required aspects of the channel.
- Returns:
A dict containing a channel object.
- Return type:
ClientResponse
- async delete_channel(channel_id, reason=None)
Delete a channel, or close a private message.
- Parameters:
channel_id (int) – The ID of the channel to be deleted/closed.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
The responce from Discord.
- Return type:
ClientResponse
- async get_channel_messages(channel_id, limit=50, before=None, after=None, around=None)
Get messages from a channel.
- Parameters:
channel_id (int) – The ID of the channel to get message from
limit (int, optional) – Max number of messages to return (1-100), by default 50
before (int, optional) – Get messages before this message ID, by default None
after (int, optional) – Get messages after this message ID, by default None
around (int, optional) – Get messages around this message ID, by default None
- Returns:
A list of message objects.
- Return type:
ClientResponse
- Raises:
InvalidParams – The limit is not between 1 and 100.
- async get_message(channel_id, message_id)
Get a message from a channel.
- Parameters:
channel_id (int) – The ID of the channel to get message from.
message_id (int) – The ID of the message that is to be retrieved.
- Returns:
A message object.
- Return type:
ClientResponse
- async create_message(channel_id, content=None, tts=None, embeds=None, allowed_mentions=None, message_reference=None, components=None, sticker_ids=None)
Post a message to a guild text or DM channel.
- Parameters:
channel_id (int) – The ID of the channel to send a message to.
content (str, optional) – Message contents (up to 2000 characters), by default None
tts (bool, optional) – true if this is a TTS message, by default None
embeds (List[dict], optional) – An array of dicts containing embed data, by default None
allowed_mentions (Any, optional) – Allowed mentions for the message, by default None
message_reference (Any, optional) – Include to make your message a reply, by default None
components (List[Any], optional) – An array of components to include with the message, by default None
sticker_ids (List[int], optional) – IDs of up to 3 stickers in the server to send in the message, by default None
- Returns:
A message object
- Return type:
ClientResponse
- Raises:
InvalidParams – content, embeds or sticker_ids must be provided.
- async crosspost_message(channel_id, message_id)
Crosspost a message in a News Channel to following channels.
- Parameters:
channel_id (int) – The ID of the channel the message to be corssposted is in.
message_id (int) – The ID of the message to be crossposted.
- Returns:
A message object.
- Return type:
ClientResponse
- async add_reaction(channel_id, message_id, emoji)
Create a reaction for a message.
- Parameters:
channel_id (int) – The ID of the channel the message is in.
message_id (int) – The ID of the message to add a reaction to.
emoji (str) – The emoji to react with.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async remove_own_reaction(channel_id, message_id, emoji)
Remove a reaction from a message.
- Parameters:
channel_id (int) – The ID of the channel the message is in.
message_id (int) – The ID of the message to remove a reaction from.
emoji (str) – The emoji to remove.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async remove_reaction(channel_id, message_id, emoji, member_id)
Remove a users reaction from a message.
- Parameters:
channel_id (int) – The ID of the channel the message is in.
message_id (int) – The ID of the message to remove a reaction from.
emoji (str) – The emoji to remove.
member_id (int) – The ID of the member thats reaction will be removed.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async get_reactions(channel_id, message_id, emoji, limit=25, after=None)
Get a list of users that reacted with this emoji.
- Parameters:
channel_id (int) – The ID of the channel the message is in.
message_id (int) – The ID of the message to get reactions from.
emoji (str) – The emoji to get reactions for.
limit (int, optional) – Max number of users to return (1-100), by default 25
after (int, optional) – Get users after this user ID, by default None
- Returns:
A list of user objects.
- Return type:
ClientResponse
- async clear_reactions(channel_id, message_id)
Deletes all reactions on a message.
- Parameters:
channel_id (int) – The ID of the channel the message is in.
message_id (int) – The ID of the message to clear reactions from.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async clear_single_reaction(channel_id, message_id, emoji)
Deletes all the reactions for a given emoji on a message.
- Parameters:
channel_id (int) – The ID of the channel the message is in.
message_id (int) – The ID of the message to clear reactions from.
emoji (str) – The emoji to clear reactions for.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async edit_message(channel_id, message_id, content=None, embeds=None, allowed_mentions=None, components=None)
Edit a previously sent message.
- Parameters:
channel_id (int) – The ID of the channel the message is in.
message_id (int) – The ID of the message to edit.
content (str, optional) – Message contents (up to 2000 characters), by default None
embeds (List[dict], optional) – An array of dicts containing embed data, by default None
allowed_mentions (Any, optional) – Allowed mentions for the message, by default None
components (List[Any], optional) – An array of components to include with the message, by default None
- Returns:
_description_
- Return type:
ClientResponse
- async delete_message(channel_id, message_id, reason=None)
Delete a message.
- Parameters:
channel_id (int) – The ID of the channel the message is in.
message_id (int) – The ID of the message to delete.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async bulk_delete_messages(channel_id, message_ids, reason=None)
Delete multiple messages.
- Parameters:
channel_id (int) – The ID of the channel the messages are in.
message_ids (List[int]) – The IDs of the messages to delete.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async edit_channel_permissions(channel_id, overwrite_id, allow, deny, type, reason=None)
Edit the channel permission overwrites for a user or role in a channel.
- Parameters:
channel_id (int) – The ID of the channel to edit permissions for.
overwrite_id (int) – The ID of the user or role to edit permissions for.
allow (str) – The bitwise value of all allowed permissions.
deny (str) – The bitwise value of all disallowed permissions.
type (int) – 0 for a role or 1 for a member
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async get_channel_invites(channel_id)
Get a list of invites for a channel.
- Parameters:
channel_id (int) – The ID of the channel to get invites for.
- Returns:
A list of invite objects
- Return type:
ClientResponse
- async create_channel_invite(channel_id, *, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user_id=None, target_application_id=None)
Create a new invite for a channel.
- Parameters:
channel_id (int) – The ID of the channel to create an invite for.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
max_age (int, optional) – Duration of invite in seconds before expiry, by default 0
max_uses (int, optional) – Max number of uses or 0 for unlimited, by default 0
temporary (bool, optional) – Whether this invite only grants temporary membership, by default False
unique (bool, optional) – If true, don’t try to reuse a similar invite, by default True
target_type (int, optional) – The type of target for this voice channel invite, by default None
target_user_id (int, optional) – The id of the user whose stream to display for this invite, by default None
target_application_id (int, optional) – The id of the embedded application to open for this invite, by default None
- Returns:
An invite object.
- Return type:
ClientResponse
- async delete_channel_permissions(channel_id, overwrite_id, reason=None)
Delete a channel permission overwrite for a user or role in a channel.
- Parameters:
channel_id (int) – The ID of the channel to delete permissions for.
overwrite_id (int) – The ID of the user or role to delete permissions for.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async follow_news_channel(channel_id, webhook_channel_id, reason=None)
Follow a News Channel to send messages to a target channel.
- Parameters:
channel_id (int) – The ID of the channel to follow.
webhook_channel_id (int) – ID of target channel.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async start_typing(channel_id)
Post a typing indicator for the specified channel.
- Parameters:
channel_id (int) – The ID of the channel to start the typing indicator in.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async get_pinned_messages(channel_id)
Get a list of pinned messages in a channel.
- Parameters:
channel_id (int) – The ID of the channel to get pinned messages for.
- Returns:
A list of message objects.
- Return type:
ClientResponse
- async pin_message(channel_id, message_id, reason=None)
Pin a message in a channel.
- Parameters:
channel_id (int) – The ID of the channel to pin the message in.
message_id (int) – The ID of the message to pin.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async unpin_message(channel_id, message_id, reason=None)
Unpin a message in a channel.
- Parameters:
channel_id (int) – The ID of the channel to unpin the message in.
message_id (int) – The ID of the message to unpin.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async add_group_recipient(channel_id, user_id, access_token, nickname=None)
Adds a recipient to a Group DM using their access token.
- Parameters:
channel_id (int) – The ID of the channel to add the recipient to.
user_id (int) – The ID of the user to add as a recipient.
access_token (str) – Access token of a user.
nickname (str, optional) – Nickname of the user being added, by default None
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async remove_group_recipient(channel_id, user_id)
Removes a recipient from a Group DM.
- Parameters:
channel_id (int) – The ID of the channel to remove the recipient from.
user_id (int) – The ID of the user to remove as a recipient.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async start_thread_from_message(channel_id, message_id, *, name, auto_archive_duration, rate_limit_per_user, reason=None)
Creates a new thread from an existing message.
- Parameters:
channel_id (int) – The ID of the channel to start the thread in.
message_id (int) – The ID of the message to start the thread from.
name (str) – 1-100 character channel name.
auto_archive_duration (int) – Duration in minutes to automatically archive the thread after recent activity.
rate_limit_per_user (int) – Amount of seconds a user has to wait before sending another message.
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
A channel object.
- Return type:
ClientResponse
- async start_thread_without_message(channel_id, name, auto_archive_duration, type, invitable=True, rate_limit_per_user=None, reason=None)
Creates a new thread.
- Parameters:
channel_id (int) – The ID of the channel to start the thread in.
name (str) – 1-100 character channel name.
auto_archive_duration (int) – Duration in minutes to automatically archive the thread after recent activity.
type (int) – The type of thread to create.
invitable (bool, optional) – Whether non-moderators can add other non-moderators to a thread, by default True
rate_limit_per_user (int, optional) – Amount of seconds a user has to wait before sending another message, by default None
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
- Returns:
A channel object.
- Return type:
ClientResponse
- async start_thread_in_forum(channel_id, name, auto_archive_duration, message, rate_limit_per_user=None, reason=None)
Creates a new thread in a forum channel.
- Parameters:
channel_id (int) – The ID of the channel to start the thread in.
name (str) – 1-100 character channel name.
auto_archive_duration (int) – Duration in minutes to automatically archive the thread after recent activity. 60, 1440, 4320 or 10080.
rate_limit_per_user (int, optional) – Amount of seconds a user has to wait before sending another message (0-21600), by default None
reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None
message (Any) – Params for a message to send in the thread.
- Returns:
A channel object, with a nested message object.
- Return type:
ClientResponse
- Raises:
InvalidParams – Invalid params were given.
- async join_thread(channel_id)
Adds the current user to a thread.
- Parameters:
channel_id (int) – The ID of the thread to join.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async add_user_to_thread(channel_id, user_id)
Adds another member to a thread.
- Parameters:
channel_id (int) – The ID of the thread to add a user to.
user_id (int) – The ID of the user to add to the thread.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async leave_thread(channel_id)
Removes the current user from a thread.
- Parameters:
channel_id (int) – The ID of the thread to leave.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async remove_user_from_thread(channel_id, user_id)
Removes a member from a thread.
- Parameters:
channel_id (int) – The ID of the thread to remove a user from.
user_id (int) – The ID of the user to remove from the thread.
- Returns:
The response from Discord.
- Return type:
ClientResponse
- async get_thread_member(channel_id, user_id)
Gets a thread member.
- Parameters:
channel_id (int) – The ID of the thread to get a member from.
user_id (int) – The ID of the user to get from the thread.
- Returns:
A thread member object.
- Return type:
ClientResponse
- async get_thread_members(channel_id)
Gets all thread members.
- Parameters:
channel_id (int) – The ID of the thread to get members from.
- Returns:
A list of thread member objects.
- Return type:
ClientResponse
- async get_public_archived_threads(channel_id, before=None, limit=50)
Returns archived threads in the channel that are public.
- Parameters:
channel_id (int) – The ID of the channel to get archived threads from.
before (ISO8601_timestamp, optional) – Returns threads before this timestamp, by default None
limit (int, optional) – Optional maximum number of threads to return, by default 50
- Returns:
A list of archived threads in the channel that are public.
- Return type:
ClientResponse
- async get_private_archived_threads(channel_id, before=None, limit=50)
Returns archived threads in the channel that are private.
- Parameters:
channel_id (int) – The ID of the channel to get archived threads from.
before (ISO8601_timestamp, optional) – Returns threads before this timestamp, by default None
limit (int, optional) – Optional maximum number of threads to return, by default 50
- Returns:
A list of archived threads in the channel that are private.
- Return type:
ClientResponse
- async get_joined_private_archived_threads(channel_id, before=None, limit=50)
Returns archived joined threads in the channel that are private.
- Parameters:
channel_id (int) – The ID of the channel to get joined archived threads from.
before (int, optional) – Returns threads before this id, by default None
limit (int, optional) – Optional maximum number of threads to return, by default 50
- Returns:
A list of archived joined threads in the channel that are private.
- Return type:
ClientResponse