Channel Models#
- enum interactions.api.models.channel.ChannelType(value)[स्रोत]#
An enumerable object representing the type of channels.
- Member Type:
Valid values are as follows:
- GUILD_TEXT = <ChannelType.GUILD_TEXT: 0>#
- DM = <ChannelType.DM: 1>#
- GUILD_VOICE = <ChannelType.GUILD_VOICE: 2>#
- GROUP_DM = <ChannelType.GROUP_DM: 3>#
- GUILD_CATEGORY = <ChannelType.GUILD_CATEGORY: 4>#
- GUILD_ANNOUNCEMENT = <ChannelType.GUILD_ANNOUNCEMENT: 5>#
- GUILD_STORE = <ChannelType.GUILD_STORE: 6>#
- ANNOUNCEMENT_THREAD = <ChannelType.ANNOUNCEMENT_THREAD: 10>#
- PUBLIC_THREAD = <ChannelType.PUBLIC_THREAD: 11>#
- PRIVATE_THREAD = <ChannelType.PRIVATE_THREAD: 12>#
- GUILD_STAGE_VOICE = <ChannelType.GUILD_STAGE_VOICE: 13>#
- GUILD_DIRECTORY = <ChannelType.GUILD_DIRECTORY: 14>#
- GUILD_FORUM = <ChannelType.GUILD_FORUM: 15>#
- class interactions.api.models.channel.Thread(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
संस्करण 4.0.2 से नया .
An object representing a thread.
टिप्पणी
This is a derivation of the base Channel, since a thread can be its own event.
- class interactions.api.models.channel.Channel(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing all types of channels.
- चर पद :
id (Snowflake) -- The (snowflake) ID of the channel.
type (ChannelType) -- The type of channel.
guild_id (Optional[Snowflake]) -- The ID of the guild if it is not a DM channel.
position (Optional[int]) -- The position of the channel.
permission_overwrites (List[Overwrite]) -- The non-synced permissions of the channel.
name (str) -- The name of the channel.
topic (Optional[str]) -- The description of the channel.
nsfw (Optional[bool]) -- Whether the channel is NSFW.
last_message_id (Snowflake) -- The ID of the last message sent.
bitrate (Optional[int]) -- The audio bitrate of the channel.
user_limit (Optional[int]) -- The maximum amount of users allowed in the channel.
rate_limit_per_user (Optional[int]) -- The concurrent ratelimit for users in the channel.
recipients (Optional[List[User]]) -- The recipients of the channel.
icon (Optional[str]) -- The icon of the channel.
owner_id (Optional[Snowflake]) -- The owner of the channel.
application_id (Optional[Snowflake]) -- The application of the channel.
parent_id (Optional[Snowflake]) -- The ID of the "parent"/main channel.
last_pin_timestamp (Optional[datetime]) -- The timestamp of the last pinned message in the channel.
rtc_region (Optional[str]) -- The region of the WebRTC connection for the channel.
video_quality_mode (Optional[int]) -- The set quality mode for video streaming in the channel.
message_count (int) -- The amount of messages in the channel.
member_count (Optional[int]) -- The amount of members in the channel.
newly_created (Optional[bool]) -- Boolean representing if a thread is created.
thread_metadata (Optional[ThreadMetadata]) -- The thread metadata of the channel.
member (Optional[ThreadMember]) -- The member of the thread in the channel.
default_auto_archive_duration (Optional[int]) -- The set auto-archive time for all threads to naturally follow in the channel.
permissions (Optional[Permissions]) -- The permissions of the channel.
flags (Optional[int]) -- The flags of the channel.
total_message_sent (Optional[int]) -- Number of messages ever sent in a thread.
default_thread_slowmode_delay (Optional[int]) -- The default slowmode delay in seconds for threads, if this channel is a forum.
available_tags (Optional[List[Tags]]) -- Tags in a forum channel, if any.
applied_tags (Optional[List[Snowflake]]) -- The IDs of tags that have been applied to a thread, if any.
default_reaction_emoji (Optional[Emoji]) -- Default reaction emoji for threads created in a forum, if any.
- property guild_id: Snowflake | None#
संस्करण 4.4.0 से नया .
Attempts to get the guild ID the channel is in.
- प्रदत्त :
The ID of the guild this channel belongs to.
- प्रदत्त प्रकार :
Optional[Snowflake]
- property guild: Guild | None#
संस्करण 4.4.0 से नया .
Attempts to get the guild the channel is in.
- प्रदत्त :
The guild this channel belongs to.
- प्रदत्त प्रकार :
- property typing: Awaitable | AbstractContextManager#
संस्करण 4.3.2 से नया .
Manages the typing of the channel. Use with await or async with
- प्रदत्त :
A manager for typing
- प्रदत्त प्रकार :
- property mention: str#
संस्करण 4.1.0 से नया .
Returns a string that allows you to mention the given channel.
- प्रदत्त :
The string of the mentioned channel.
- प्रदत्त प्रकार :
- property voice_states: List[VoiceState]#
संस्करण 4.4.0 से नया .
Returns all voice states this channel has. Only applicable for voice channels.
- प्रदत्त प्रकार :
List[VoiceState]
- history(start_at=<interactions.MISSING>, reverse=False, maximum=inf, check=None)[स्रोत]#
संस्करण 4.3.2 से नया .
- मापदण्ड:
start_at (Optional[Union[int, str, Snowflake, Message]]) -- The message to begin getting the history from
reverse (Optional[bool]) -- Whether to only get newer message. Default False
maximum (Optional[int]) -- A set maximum of messages to get before stopping the iteration
check (Optional[Callable[[Message], Union[bool, Awaitable[bool]]]]) -- A custom check to ignore certain messages
- प्रदत्त :
An asynchronous iterator over the history of the channel
- प्रदत्त प्रकार :
- async send(content=<interactions.MISSING>, *, tts=<interactions.MISSING>, attachments=<interactions.MISSING>, files=<interactions.MISSING>, embeds=<interactions.MISSING>, allowed_mentions=<interactions.MISSING>, stickers=<interactions.MISSING>, components=<interactions.MISSING>)[स्रोत]#
संस्करण 4.0.2 से नया .
Sends a message in the channel.
- मापदण्ड:
content (Optional[str]) -- The contents of the message as a string or string-converted value.
tts (Optional[bool]) -- Whether the message utilizes the text-to-speech Discord programme or not.
files (Optional[Union[File, List[File]]]) --
संस्करण 4.2.0 से नया .
A file or list of files to be attached to the message.
attachments (Optional[List[Attachment]]) --
संस्करण 4.3.0 से नया .
The attachments to attach to the message. Needs to be uploaded to the CDN first.
embeds (Optional[Union[Embed, List[Embed]]]) -- An embed, or list of embeds for the message.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) -- The allowed mentions for the message.
stickers (Optional[List[Sticker]]) --
संस्करण 4.3.0 से नया .
A list of stickers to send with your message. You can send up to 3 stickers per message.
components (Optional[Union[ActionRow, Button, SelectMenu, List[Actionrow], List[Button], List[SelectMenu]]]) -- A component, or list of components for the message.
- प्रदत्त :
The sent message as an object.
- प्रदत्त प्रकार :
- async modify(name=<interactions.MISSING>, topic=<interactions.MISSING>, bitrate=<interactions.MISSING>, user_limit=<interactions.MISSING>, rate_limit_per_user=<interactions.MISSING>, position=<interactions.MISSING>, permission_overwrites=<interactions.MISSING>, parent_id=<interactions.MISSING>, nsfw=<interactions.MISSING>, archived=<interactions.MISSING>, auto_archive_duration=<interactions.MISSING>, locked=<interactions.MISSING>, reason=None)[स्रोत]#
संस्करण 4.0.2 से नया .
Edits the channel.
संस्करण 4.2.0 से नया : The fields
archived,auto_archive_durationandlocked. All require the provided channel to be a thread.- मापदण्ड:
name (Optional[str]) -- The name of the channel, defaults to the current value of the channel
topic (Optional[str]) -- The topic of that channel, defaults to the current value of the channel
bitrate (Optional[int]) -- (voice channel only) The bitrate (in bits) of the voice channel, defaults to the current value of the channel
user_limit (Optional[int]) -- (voice channel only) Maximum amount of users in the channel, defaults to the current value of the channel
rate_limit_per_user (Optional[int]) -- Amount of seconds a user has to wait before sending another message (0-21600), defaults to the current value of the channel
position (Optional[int]) -- Sorting position of the channel, defaults to the current value of the channel
parent_id (Optional[int]) -- The id of the parent category for a channel, defaults to the current value of the channel
nsfw (Optional[bool]) -- Whether the channel is nsfw or not, defaults to the current value of the channel
permission_overwrites (Optional[List[Overwrite]]) -- The permission overwrites, if any
archived (Optional[bool]) --
संस्करण 4.2.0 से नया .
Whether the thread is archived
auto_archive_duration (Optional[int]) --
संस्करण 4.2.0 से नया .
The time after the thread is automatically archived. One of 60, 1440, 4320, 10080
locked (Optional[bool]) --
संस्करण 4.2.0 से नया .
Whether the thread is locked
reason (Optional[str]) -- The reason for the edit
- प्रदत्त :
The modified channel as new object
- प्रदत्त प्रकार :
- async set_topic(topic, *, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Sets the topic of the channel.
- async set_bitrate(bitrate, *, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Sets the bitrate of the channel.
- async set_user_limit(user_limit, *, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Sets the user_limit of the channel.
- async set_rate_limit_per_user(rate_limit_per_user, *, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Sets the amount of seconds a user has to wait before sending another message.
- async set_position(position, *, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Sets the position of the channel.
- async set_parent_id(parent_id, *, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Sets the parent_id of the channel.
- async set_nsfw(nsfw, *, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Sets the nsfw-flag of the channel.
- async archive(archived=True, *, reason=None)[स्रोत]#
संस्करण 4.2.0 से नया .
Sets the archived state of the thread.
- async set_auto_archive_duration(auto_archive_duration, *, reason=None)[स्रोत]#
संस्करण 4.2.0 से नया .
Sets the time after the thread is automatically archived.
- async lock(locked=True, *, reason=None)[स्रोत]#
संस्करण 4.2.0 से नया .
Sets the locked state of the thread.
- async add_member(member_id)[स्रोत]#
संस्करण 4.2.0 से नया .
This adds a member to the channel, if the channel is a thread.
- मापदण्ड:
member_id (int) -- The id of the member to add to the channel
- async remove_member(member_id)[स्रोत]#
संस्करण 4.3.0 से नया .
This removes a member of the channel, if the channel is a thread.
- मापदण्ड:
member_id (int) -- The id of the member to remove of the channel
- async publish_message(message_id)[स्रोत]#
संस्करण 4.0.2 से नया .
Publishes (API calls it crossposts) a message in the channel to any that is followed by.
- async get_pinned_messages()[स्रोत]#
संस्करण 4.0.2 से नया .
Get all pinned messages from the channel.
- प्रदत्त :
A list of pinned message objects.
- प्रदत्त प्रकार :
List[Message]
- async purge(amount, check=<interactions.MISSING>, before=<interactions.MISSING>, reason=None, bulk=True, force_bulk=False)[स्रोत]#
संस्करण 4.1.0 से नया .
Purges a given amount of messages from a channel. You can specify a check function to exclude specific messages.
चेतावनी
Calling this method can lead to rate-limits when purging higher amounts of messages.
def check_pinned(message): return not message.pinned # This returns `True` only if the message is the message is not pinned await channel.purge(100, check=check_pinned) # This will delete the newest 100 messages that are not pinned in that channel
- मापदण्ड:
amount (int) -- The amount of messages to delete
check (Optional[Callable[[Any], Union[bool, Awaitable[bool]]]]) -- The function used to check if a message should be deleted. The message is only deleted if the check returns True
before (Optional[int]) -- An id of a message to purge only messages before that message
bulk (Optional[bool]) --
Whether to use the bulk delete endpoint for deleting messages. This only works for 14 days
संस्करण 4.4.0 से अलग : Purge now automatically continues deleting messages even after the 14 days limit was hit. Check
force_bulkfor more information. If the 14 days span is exceeded the bot will encounter rate-limits more frequently.reason (Optional[st]) -- The reason of the deletes
force_bulk (Optional[bool]) --
संस्करण 4.4.0 से नया : Whether to stop deleting messages when the 14 days bulk limit was hit, default
False
- प्रदत्त :
A list of the deleted messages
- प्रदत्त प्रकार :
List[Message]
- async create_thread(name, type=ChannelType.PUBLIC_THREAD, auto_archive_duration=<interactions.MISSING>, invitable=<interactions.MISSING>, message_id=<interactions.MISSING>, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Creates a thread in the Channel.
- मापदण्ड:
name (str) -- The name of the thread
auto_archive_duration (Optional[int]) -- duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
type (Optional[ChannelType]) -- The type of thread, defaults to public. ignored if creating thread from a message
invitable (Optional[bool]) -- Boolean to display if the Thread is open to join or private.
message_id (Optional[Union[int, Snowflake, Message]]) -- An optional message to create a thread from.
reason (Optional[str]) -- An optional reason for the audit log
- प्रदत्त :
The created thread
- प्रदत्त प्रकार :
- async create_invite(max_age=86400, max_uses=0, temporary=False, unique=False, target_type=<interactions.MISSING>, target_user_id=<interactions.MISSING>, target_application_id=<interactions.MISSING>, reason=None)[स्रोत]#
Creates an invite for the channel
- मापदण्ड:
max_age (Optional[int]) -- Duration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days). Default 86400 (24h)
max_uses (Optional[int]) -- Max number of uses or 0 for unlimited. between 0 and 100. Default 0
temporary (Optional[bool]) -- Whether this invite only grants temporary membership. Default False
unique (Optional[bool]) -- If true, don't try to reuse a similar invite (useful for creating many unique one time use invites). Default False
target_type (Optional[InviteTargetType]) -- The type of target for this voice channel invite
target_user_id (Optional[int]) -- The id of the user whose stream to display for this invite, required if target_type is STREAM, the user must be streaming in the channel
target_application_id (Optional[int]) -- The id of the embedded application to open for this invite, required if target_type is EMBEDDED_APPLICATION, the application must have the EMBEDDED flag
reason (Optional[str]) -- The reason for the creation of the invite
- प्रदत्त प्रकार :
- async get_history(limit=100)[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.3.2 से प्रतिबंधित : Use the
history()method insteadGets messages from the channel's history.
- async get_members()[स्रोत]#
संस्करण 4.3.0 से नया .
Gets the list of thread members
- प्रदत्त :
The members of the thread.
- प्रदत्त प्रकार :
List[ThreadMember]
- async create_tag(name, emoji_id=<interactions.MISSING>, emoji_name=<interactions.MISSING>)[स्रोत]#
संस्करण 4.3.2 से नया .
Create a new tag.
टिप्पणी
Can either have an emoji_id or an emoji_name, but not both. emoji_id is meant for custom emojis, emoji_name is meant for unicode emojis.
- async edit_tag(tag_id, name, emoji_name=<interactions.MISSING>, emoji_id=<interactions.MISSING>)[स्रोत]#
संस्करण 4.3.2 से नया .
Edits a tag
टिप्पणी
Can either have an emoji_id or an emoji_name, but not both. emoji_id is meant for custom emojis, emoji_name is meant for unicode emojis.
- मापदण्ड:
- प्रदत्त :
The modified tag
- प्रदत्त प्रकार :
- async create_forum_post(name, content, auto_archive_duration=<interactions.MISSING>, applied_tags=<interactions.MISSING>, files=<interactions.MISSING>, rate_limit_per_user=<interactions.MISSING>, reason=None)[स्रोत]#
संस्करण 4.3.2 से नया .
Creates a new post inside a forum channel
- मापदण्ड:
name (str) -- The name of the thread
auto_archive_duration (Optional[int]) -- duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
content (Union[dict, Message, str, Attachment, List[Attachment]]) -- The content to send as first message.
applied_tags (Union[List[str], List[int], List[Tags], int, str, Tags]) -- Tags to give to the created thread
files (Optional[List[File]]) -- An optional list of files to send attached to the message.
rate_limit_per_user (Optional[int]) -- Seconds a user has to wait before sending another message (0 to 21600), if given.
reason (Optional[str]) -- An optional reason for the audit log
- प्रदत्त :
A channel of type
ChannelType.PUBLIC_THREAD- प्रदत्त प्रकार :
- async get_permissions_for(member)[स्रोत]#
संस्करण 4.3.2 से नया .
Returns the permissions of the member in this specific channel.
टिप्पणी
The permissions returned by this function take into account role and user overwrites that can be assigned to channels or categories. If you don't need these overwrites, look into
Member.get_guild_permissions().- मापदण्ड:
member (Member) -- The member to get the permissions from
- प्रदत्त :
Permissions of the member in this channel
- प्रदत्त प्रकार :
- async add_permission_overwrite(id, type=<interactions.MISSING>, allow=<interactions.MISSING>, deny=<interactions.MISSING>, reason=None)[स्रोत]#
संस्करण 4.4.0 से नया .
Adds a permission overwrite to the channel.
- मापदण्ड:
id (Union[int, str, Snowflake, User, Role]) -- The ID of the User/Role to create the overwrite on.
type (Optional[Literal[0, 1, "0", "1"]]) -- The type of the overwrite. 0 for Role 1 for User.
allow (Optional[Union[int, Permissions, str]]) -- Permissions to allow
deny (Optional[Union[int, Permissions, str]]) -- Permissions to deny
reason (Optional[str]) -- The reason to be shown in the audit log
- प्रदत्त :
The updated channel
- प्रदत्त प्रकार :
- async add_permission_overwrites(overwrites, reason=None)[स्रोत]#
संस्करण 4.4.0 से नया .
Add multiple overwrites to the channel.
- async overwrite_permission_overwrites(overwrites, reason=None)[स्रोत]#
संस्करण 4.4.0 से नया .
Overwrites the overwrites of the channel with new overwrites.
- class interactions.api.models.channel.ThreadMember(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing a member in a thread.
टिप्पणी
idonly shows if there are active intents involved with the member in the thread.- चर पद :
id (Optional[Snowflake]) -- The "ID" or intents of the member.
user_id (Snowflake) -- The user ID of the member.
join_timestamp (datetime) -- The timestamp of when the member joined the thread.
flags (int) -- The bitshift flags for the member in the thread.
muted (bool) -- Whether the member is muted or not.
- class interactions.api.models.channel.ThreadMetadata(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing the metadata of a thread.
टिप्पणी
invitablewill only show if the thread can have an invited created with the current cached permissions.- चर पद :
archived (bool) -- The current thread accessibility state.
auto_archive_duration (int) -- The auto-archive time.
archive_timestamp (datetime) -- The timestamp that the thread will be/has been closed at.
locked (bool) -- The current message state of the thread.
invitable (Optional[bool]) -- The ability to invite users to the thread.
- class interactions.api.models.channel.AsyncHistoryIterator(_client, obj, maximum=inf, start_at=<interactions.MISSING>, check=None, reverse=False)[स्रोत]#
संस्करण 4.3.2 से नया .
A class object that allows iterating through a channel's history.
- मापदण्ड:
_client (HTTPClient) -- The HTTPClient of the bot
obj (Union[int, str, Snowflake, Channel]) -- The channel to get the history from
start_at (Optional[Union[int, str, Snowflake, Message]]) -- The message to begin getting the history from
reverse (Optional[bool]) -- Whether to only get newer message. Default False
check (Optional[Callable[[Message], Union[bool, Awaitable[bool]]]]) -- A check to ignore certain messages
maximum (Optional[int]) -- A set maximum of messages to get before stopping the iteration
- class interactions.api.models.channel.AsyncTypingContextManager(obj, _client)[स्रोत]#
संस्करण 4.3.2 से नया .
An async context manager for triggering typing.
- class interactions.api.models.channel.Tags(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
संस्करण 4.3.2 से नया .
An object denoting a tag object within a forum channel.
टिप्पणी
If the emoji is custom, it won't have name information.
- चर पद :
name (str) -- Name of the tag. The limit is up to 20 characters.
id (Snowflake) -- ID of the tag. Can also be 0 if manually created.
moderated (bool) -- A boolean denoting whether this tag can be removed/added by moderators with the
Permissions.MANAGE_THREADSpermission.emoji_name (Optional[str]) -- The unicode character of the emoji.
emoji_id (Optional[Snowflake]) -- The id of a guild's custom emoji.
- async edit(channel_id, name, emoji_name=<interactions.MISSING>, emoji_id=<interactions.MISSING>)[स्रोत]#
Edits this tag
टिप्पणी
Can either have an emoji_id or an emoji_name, but not both. emoji_id is meant for custom emojis, emoji_name is meant for unicode emojis.
- मापदण्ड:
- प्रदत्त :
The modified tag
- प्रदत्त प्रकार :