Message Models#
- enum interactions.api.models.message.MessageType(value)[स्रोत]#
An enumerable object representing the types of messages.
टिप्पणी
There is no official name for MessageType 25, however it does represent when someone subscribes to a server for the first time.
- Member Type:
Valid values are as follows:
- DEFAULT = <MessageType.DEFAULT: 0>#
- RECIPIENT_ADD = <MessageType.RECIPIENT_ADD: 1>#
- RECIPIENT_REMOVE = <MessageType.RECIPIENT_REMOVE: 2>#
- CALL = <MessageType.CALL: 3>#
- CHANNEL_NAME_CHANGE = <MessageType.CHANNEL_NAME_CHANGE: 4>#
- CHANNEL_ICON_CHANGE = <MessageType.CHANNEL_ICON_CHANGE: 5>#
- CHANNEL_PINNED_MESSAGE = <MessageType.CHANNEL_PINNED_MESSAGE: 6>#
- GUILD_MEMBER_JOIN = <MessageType.GUILD_MEMBER_JOIN: 7>#
- USER_PREMIUM_GUILD_SUBSCRIPTION = <MessageType.USER_PREMIUM_GUILD_SUBSCRIPTION: 8>#
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = <MessageType.USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1: 9>#
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = <MessageType.USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2: 10>#
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = <MessageType.USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3: 11>#
- CHANNEL_FOLLOW_ADD = <MessageType.CHANNEL_FOLLOW_ADD: 12>#
- GUILD_DISCOVERY_DISQUALIFIED = <MessageType.GUILD_DISCOVERY_DISQUALIFIED: 14>#
- GUILD_DISCOVERY_REQUALIFIED = <MessageType.GUILD_DISCOVERY_REQUALIFIED: 15>#
- GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = <MessageType.GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING: 16>#
- GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = <MessageType.GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING: 17>#
- THREAD_CREATED = <MessageType.THREAD_CREATED: 18>#
- REPLY = <MessageType.REPLY: 19>#
- APPLICATION_COMMAND = <MessageType.APPLICATION_COMMAND: 20>#
- THREAD_STARTER_MESSAGE = <MessageType.THREAD_STARTER_MESSAGE: 21>#
- GUILD_INVITE_REMINDER = <MessageType.GUILD_INVITE_REMINDER: 22>#
- CONTEXT_MENU_COMMAND = <MessageType.CONTEXT_MENU_COMMAND: 23>#
- AUTO_MODERATION_ACTION = <MessageType.AUTO_MODERATION_ACTION: 24>#
- ROLE_SUBSCRIPTION_PURCHASE = <MessageType.ROLE_SUBSCRIPTION_PURCHASE: 25>#
The
Enumand its members also have the following methods:
- class interactions.api.models.message.Message(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing a message.
- चर पद :
id (Snowflake) -- ID of the message.
channel_id (Snowflake) -- ID of the channel the message was sent in
guild_id (Optional[Snowflake]) -- ID of the guild the message was sent in, if it exists.
author (User) -- The author of the message.
member (Optional[Member]) -- The member object associated with the author, if any.
content (str) -- Message contents.
timestamp (datetime) -- Timestamp denoting when the message was sent.
edited_timestamp (Optional[datetime]) -- Timestamp denoting when the message was edited, if any.
tts (bool) -- Status dictating if this was a TTS message or not.
mention_everyone (bool) -- Status dictating of this message mentions everyone
mentions (Optional[List[Union[Member, User]]]) -- Array of user objects with an additional partial member field.
mention_roles (Optional[List[str]]) -- Array of roles mentioned in this message
mention_channels (Optional[List[ChannelMention]]) -- Channels mentioned in this message, if any.
attachments (List[Attachment]) -- An array of attachments
embeds (List[Embed]) -- An array of embeds
reactions (Optional[List[ReactionObject]]) -- Reactions to the message.
pinned (bool) -- Whether this message is pinned.
webhook_id (Optional[Snowflake]) -- Webhook ID if the message is generated by a webhook.
type (MessageType) -- Type of message
activity (Optional[MessageActivity]) -- Message activity object that's sent by Rich Presence
application (Optional[Application]) -- Application object that's sent by Rich Presence
message_reference (Optional[MessageReference]) -- Data showing the source of a message (crosspost, channel follow, add, pin, or replied message)
flags (Optional[MessageFlags]) -- Message flags
referenced_message (Optional[Message]) -- The message associated with the message_reference.
interaction (Optional[MessageInteraction]) -- Message interaction object, if the message is sent by an interaction.
thread (Optional[Channel]) -- The thread that started from this message, if any, with a thread member object embedded.
components (Optional[List[ActionRow]]) -- Array of Action Rows associated with this message, if any.
sticker_items (Optional[List[PartialSticker]]) -- An array of message sticker item objects, if sent with them.
stickers (Optional[List[Sticker]]) -- Array of sticker objects sent with the message if any. Deprecated.
position (Optional[int]) -- The approximate position of the message in a thread.
- async get_channel()[स्रोत]#
संस्करण 4.0.2 से नया .
Gets the channel where the message was sent.
- प्रदत्त प्रकार :
- async get_guild()[स्रोत]#
संस्करण 4.0.2 से नया .
Gets the guild where the message was sent.
- प्रदत्त प्रकार :
- async delete(reason=None)[स्रोत]#
संस्करण 4.0.2 से नया .
Deletes the message.
- मापदण्ड:
reason (Optional[str]) -- Optional reason to show up in the audit log. Defaults to None.
- async edit(content=<interactions.MISSING>, *, tts=<interactions.MISSING>, files=<interactions.MISSING>, embeds=<interactions.MISSING>, suppress_embeds=<interactions.MISSING>, allowed_mentions=<interactions.MISSING>, message_reference=<interactions.MISSING>, attachments=<interactions.MISSING>, components=<interactions.MISSING>)[स्रोत]#
संस्करण 4.0.2 से नया .
This method edits a message. Only available for messages sent by the bot.
- मापदण्ड:
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.
embeds (Optional[Union[Embed, List[Embed]]]) -- An embed, or list of embeds for the message.
suppress_embeds (Optional[bool]) --
संस्करण 4.3.0 से नया : Whether to suppress embeds in the message.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) -- The allowed mentions for the message.
attachments (Optional[List[Attachment]]) --
संस्करण 4.3.0 से नया : The attachments to attach to the message. Needs to be uploaded to the CDN first
components (Optional[Union[ActionRow, Button, SelectMenu, List[ActionRow], List[Button], List[SelectMenu]]]) -- A component, or list of components for the message. If [] the components will be removed
- प्रदत्त :
The edited message as an object.
- प्रदत्त प्रकार :
- async reply(content=<interactions.MISSING>, *, tts=<interactions.MISSING>, embeds=<interactions.MISSING>, files=<interactions.MISSING>, attachments=<interactions.MISSING>, allowed_mentions=<interactions.MISSING>, stickers=<interactions.MISSING>, components=<interactions.MISSING>)[स्रोत]#
संस्करण 4.0.2 से नया .
Sends a new message replying to the old.
- मापदण्ड:
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.
attachments (Optional[List[Attachment]]) --
संस्करण 4.3.0 से नया : The attachments to attach to the message. Needs to be uploaded to the CDN first
files (Optional[Union[File, List[File]]]) --
संस्करण 4.2.0 से नया : A file or list of files to be attached to the message.
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.
components (Optional[Union[ActionRow, Button, SelectMenu, List[ActionRow], List[Button], List[SelectMenu]]]) -- A component, or list of components for the message.
stickers (Optional[List[Sticker]]) -- A list of stickers to send with your message. You can send up to 3 stickers per message.
- प्रदत्त :
The sent message as an object.
- प्रदत्त प्रकार :
- async publish()[स्रोत]#
संस्करण 4.0.2 से नया .
Publishes (API calls it crossposts) the message in its channel to any that is followed by.
- प्रदत्त :
message object
- प्रदत्त प्रकार :
- async create_thread(name, auto_archive_duration=<interactions.MISSING>, invitable=<interactions.MISSING>, reason=None)[स्रोत]#
संस्करण 4.1.0 से नया .
Creates a thread from the message.
- मापदण्ड:
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
invitable (Optional[bool]) -- Boolean to display if the Thread is open to join or private.
reason (Optional[str]) -- An optional reason for the audit log
- प्रदत्त :
The created thread
- प्रदत्त प्रकार :
- async remove_all_reactions_of(emoji)[स्रोत]#
संस्करण 4.2.0 से नया .
Removes all reactions of one emoji of the message.
- async remove_own_reaction_of(emoji)[स्रोत]#
संस्करण 4.2.0 से नया .
Removes the own reaction of an emoji of the message.
- async remove_reaction_from(emoji, user)[स्रोत]#
संस्करण 4.2.0 से नया .
Removes another reaction of an emoji of the message.
- async get_users_from_reaction(emoji)[स्रोत]#
संस्करण 4.2.0 से नया .
Retrieves all users that reacted to the message with the given emoji
- async classmethod get_from_url(url, client)[स्रोत]#
संस्करण 4.1.0 से नया .
Gets a Message based from its url.
- class interactions.api.models.message.MessageReference(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing the "referenced"/replied message.
टिप्पणी
All of the attributes in this class are optionals because a message can potentially never be referenced.
- चर पद :
- class interactions.api.models.message.MessageActivity(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing the activity state of a message.
टिप्पणी
party_idis ambiguous -- Discord poorly documented this. :)We assume it's for game rich presence invites? i.e. : Phasmophobia and Call of Duty.
- class interactions.api.models.message.MessageInteraction(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object that resembles the interaction used to generate the associated message.
- class interactions.api.models.message.ChannelMention(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object that resembles the mention of a channel in a guild.
- class interactions.api.models.message.Embed(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing an embed.
टिप्पणी
The example provided below is for a very basic implementation of an embed. Embeds are more unique than what is being shown.
The structure for an embed:
interactions.Embed( title="Embed title", fields=[interactions.EmbedField(...)], )
- चर पद :
title (Optional[str]) -- Title of embed
type (Optional[str]) -- Embed type, relevant by CDN file connected. This is only important to rendering.
description (Optional[str]) -- Embed description
url (Optional[str]) -- URL of embed
timestamp (Optional[datetime]) -- Timestamp of embed content
color (Optional[int]) -- Color code of embed
footer (Optional[EmbedFooter]) -- Footer information
image (Optional[EmbedImageStruct]) -- Image information
thumbnail (Optional[EmbedImageStruct]) -- Thumbnail information
video (Optional[EmbedImageStruct]) -- Video information
provider (Optional[EmbedProvider]) -- Provider information
author (Optional[EmbedAuthor]) -- Author information
fields (Optional[List[EmbedField]]) -- A list of fields denoting field information
- add_field(name, value, inline=False)[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Adds a field to the embed
- clear_fields()[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Clears all the fields of the embed
- प्रदत्त प्रकार :
- insert_field_at(index, name, value, inline=False)[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Inserts a field in the embed at the specified index
- set_field_at(index, name, value, inline=False)[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Overwrites the field in the embed at the specified index
- remove_field(index)[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Remove field at the specified index
- remove_author()[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Removes the embed's author
- प्रदत्त प्रकार :
- set_author(name, url=None, icon_url=None, proxy_icon_url=None)[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Sets the embed's author
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Sets the embed's footer
- set_image(url, proxy_url=None, height=None, width=None)[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Sets the embed's image
- set_video(url, proxy_url=None, height=None, width=None)[स्रोत]#
संस्करण 4.2.0 से नया .
संस्करण 4.4.0 से अलग : returns the embed instead of None
Sets the embed's video
- class interactions.api.models.message.EmbedAuthor(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing the author of an embed.
The structure of an embed author:
interactions.EmbedAuthor( name="fl0w#0001", )
- class interactions.api.models.message.EmbedProvider(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing the provider of an embed.
- class interactions.api.models.message.EmbedImageStruct(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing the structure of an image in an embed.
The structure of an embed image:
interactions.EmbedImageStruct( url="https://example.com/", height=300, width=250, )
- class interactions.api.models.message.EmbedField(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing the field of an embed.
The structure of an embed field:
interactions.EmbedField( name="field title", value="blah blah blah", inline=False, )
- class interactions.api.models.message.Attachment(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing an attachment in a message.
टिप्पणी
heightandwidthhave values based off ofcontent_type, which requires it to be a media file with viewabiltity as a photo, animated photo, GIF and/or video.If
ephemeralis given, the attachments will automatically be removed after a set period of time. In the case of regular messages, they're available as long as the message associated with the attachment exists.- चर पद :
id (int) -- The ID of the attachment.
filename (str) -- The name of the attachment file.
description (Optional[str]) -- The description of the file.
content_type (Optional[str]) -- The type of attachment file.
size (int) -- The size of the attachment file.
url (str) -- The CDN URL of the attachment file.
proxy_url (str) -- The proxied/cached CDN URL of the attachment file.
height (Optional[int]) -- The height of the attachment file.
width (Optional[int]) -- The width of the attachment file.
ephemeral (Optional[bool]) -- Whether the attachment is ephemeral.
A class object representing the footer of an embed.
The structure of an embed footer:
interactions.EmbedFooter( text="yo mama so short, she can fit in here", )
- class interactions.api.models.message.ReactionObject(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
The reaction object.
- class interactions.api.models.message.PartialSticker(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
Partial object for a Sticker.
- चर पद :
- class interactions.api.models.message.Sticker(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class object representing a full sticker apart from a partial.
- चर पद :
id (Snowflake) -- ID of the sticker
pack_id (Optional[Snowflake]) -- ID of the pack the sticker is from.
name (str) -- Name of the sticker
description (Optional[str]) -- Description of the sticker
tags (str) -- Autocomplete/suggestion tags for the sticker (max 200 characters)
asset (str) -- Previously a sticker asset hash, now an empty string.
type (int) -- Type of sticker
format_type (int) -- Type of sticker format
available (Optional[bool]) -- Status denoting if this sticker can be used. (Can be false via server boosting)
guild_id (Optional[Snowflake]) -- Guild ID that owns the sticker.
user (Optional[User]) -- The user that uploaded the sticker.
sort_value (Optional[int]) -- The standard sticker's sort order within its pack
- class interactions.api.models.message.StickerPack(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A class objects representing a pack of stickers.
- चर पद :
id (Snowflake) -- ID of the sticker pack.
stickers (List[Sticker]) -- The stickers in the pack.
name (str) -- The name of sticker pack.
sku_id (Snowflake) -- ID of the pack's SKU.
cover_sticker_id (Optional[Snowflake]) -- ID of a sticker in the pack which is shown as the pack's icon.
description (str) -- The description of sticker pack.
banned_asset_id (Optional[Snowflake]) -- ID of the sticker pack's banner image.