Event Context#
- class interactions.client.context.CommandContext(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A derivation of context designed specifically for application command data.
- चर पद :
id (Snowflake) -- The ID of the interaction.
application_id (Snowflake) -- The application ID of the interaction.
type (InteractionType) -- The type of interaction.
data (InteractionData) -- The application command data.
target (Optional[Union[Message, Member, User]]) -- The target selected if this interaction is invoked as a context menu.
token (str) -- The token of the interaction response.
guild_id (Snowflake) -- The ID of the current guild.
channel_id (Snowflake) -- The ID of the current channel.
user (User) -- The user data model.
responded (bool) -- Whether an original response was made or not.
deferred (bool) -- Whether the response was deferred or not.
locale (Optional[Locale]) -- The selected language of the user invoking the interaction.
guild_locale (Optional[Locale]) -- The guild's preferred language, if invoked in a guild.
app_permissions (Permissions) -- Bitwise set of permissions the bot has within the channel the interaction was sent from.
client (Client) --
संस्करण 4.3.0 से नया .
The client instance that the command belongs to.
command (Command) --
संस्करण 4.3.0 से नया .
The command object that is being invoked.
extension (Extension) --
संस्करण 4.3.0 से नया .
The extension the command belongs to.
- async edit(content=<interactions.MISSING>, **kwargs)[स्रोत]#
This allows the invocation state described in the "context" to send an interaction response.
- मापदण्ड:
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]]) -- The attachments to attach to the message. Needs to be uploaded to the CDN first
files (Optional[Union[File, List[File]]]) --
संस्करण 4.4.0 से नया .
The files to attach 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.
message_reference (Optional[MessageReference]) -- Include to make your message a reply.
components (Optional[Union[ActionRow, Button, SelectMenu, List[Union[ActionRow, Button, SelectMenu]]]]) -- A component, or list of components for the message.
- प्रदत्त :
The edited message.
- प्रदत्त प्रकार :
- async send(content=<interactions.MISSING>, **kwargs)[स्रोत]#
This allows the invocation state described in the "context" to send an interaction response.
- मापदण्ड:
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]]) -- The attachments to attach to the message. Needs to be uploaded to the CDN first
files (Optional[Union[File, List[File]]]) --
संस्करण 4.4.0 से नया .
The files to attach 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[Union[ActionRow, Button, SelectMenu]]]]) -- A component, or list of components for the message.
ephemeral (Optional[bool]) -- Whether the response is hidden or not.
suppress_embeds (Optional[bool]) -- Whether embeds are not shown in the message.
- प्रदत्त :
The sent message.
- प्रदत्त प्रकार :
- async populate(choices)[स्रोत]#
This "populates" the list of choices that the client-end user will be able to select from in the autocomplete field.
चेतावनी
Only a maximum of
25choices may be presented within an autocomplete option.
- property channel: Channel | None#
संस्करण 4.1.0 से नया .
संस्करण 4.4.0 से अलग : Channel now returns
Noneinstead ofMISSINGif it is not found to avoid confusionReturns the current channel, if cached.
- async defer(ephemeral=False, edit_origin=False)#
संस्करण 4.4.0 से अलग : Now returns the created message object
This "defers" an interaction response, allowing up to a 15-minute delay between invocation and responding.
- property deferred_ephemeral: bool#
संस्करण 4.4.0 से नया .
Returns whether the current interaction was deferred ephemerally.
- async delete()#
This deletes the interaction response of a message sent by the contextually derived information from this class.
टिप्पणी
Doing this will proceed in the context message no longer being present.
- async get_channel()#
संस्करण 4.1.0 से नया .
This gets the channel the context was invoked in. If the channel is not cached, an HTTP request is made.
- प्रदत्त :
The channel as object
- प्रदत्त प्रकार :
- async get_guild()#
संस्करण 4.1.0 से नया .
This gets the guild the context was invoked in. If the guild is not cached, an HTTP request is made.
- प्रदत्त :
The guild as object
- प्रदत्त प्रकार :
- property guild: Guild | None#
संस्करण 4.1.0 से नया .
संस्करण 4.4.0 से अलग : Guild now returns
Noneinstead ofMISSINGif it is not found to avoid confusionReturns the current guild, if cached.
- async has_permissions(*permissions, operator='and')#
संस्करण 4.3.2 से नया .
Returns whether the author of the interaction has the permissions in the given context.
- मापदण्ड:
*permissions (Union[int, Permissions]) -- The list of permissions
operator (Optional[str]) -- The operator to use to calculate permissions. Possible values:
and,or. Defaults toand.
- प्रदत्त :
Whether the author has the permissions
- प्रदत्त प्रकार :
- class interactions.client.context.ComponentContext(kwargs_dict=None, /, **other_kwargs)[स्रोत]#
A derivation of context designed specifically for component data.
- चर पद :
id (Snowflake) -- The ID of the interaction.
application_id (Snowflake) -- The application ID of the interaction.
type (InteractionType) -- The type of interaction.
data (InteractionData) -- The application command data.
token (str) -- The token of the interaction response.
guild_id (Snowflake) -- The ID of the current guild.
channel_id (Snowflake) -- The ID of the current channel.
message (Optional[Message]) -- The message data model.
user (User) -- The user data model.
responded (bool) -- Whether an original response was made or not.
deferred (bool) -- Whether the response was deferred or not.
locale (Optional[Locale]) -- The selected language of the user invoking the interaction.
guild_locale (Optional[Locale]) -- The guild's preferred language, if invoked in a guild.
app_permissions (Permissions) -- Bitwise set of permissions the bot has within the channel the interaction was sent from.
- async edit(content=<interactions.MISSING>, **kwargs)[स्रोत]#
This allows the invocation state described in the "context" to send an interaction response.
- मापदण्ड:
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]]) -- The attachments to attach to the message. Needs to be uploaded to the CDN first
files (Optional[Union[File, List[File]]]) --
संस्करण 4.4.0 से नया .
The files to attach 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.
message_reference (Optional[MessageReference]) -- Include to make your message a reply.
components (Optional[Union[ActionRow, Button, SelectMenu, List[Union[ActionRow, Button, SelectMenu]]]]) -- A component, or list of components for the message.
- प्रदत्त :
The edited message.
- प्रदत्त प्रकार :
- async send(content=<interactions.MISSING>, **kwargs)[स्रोत]#
This allows the invocation state described in the "context" to send an interaction response.
- मापदण्ड:
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]]) -- The attachments to attach to the message. Needs to be uploaded to the CDN first
files (Optional[Union[File, List[File]]]) --
संस्करण 4.4.0 से नया .
The files to attach 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[Union[ActionRow, Button, SelectMenu]]]]) -- A component, or list of components for the message.
ephemeral (Optional[bool]) -- Whether the response is hidden or not.
suppress_embeds (Optional[bool]) -- Whether embeds are not shown in the message.
- प्रदत्त :
The sent message.
- प्रदत्त प्रकार :
- async disable_all_components(respond_to_interaction=True, **other_kwargs)[स्रोत]#
संस्करण 4.3.2 से नया .
Disables all components of the message.
- मापदण्ड:
respond_to_interaction (Optional[bool]) -- Whether the components should be disabled in an interaction response, default True
**other_kwargs (Optional[dict]) -- Additional keyword-arguments to pass to the edit method. This only works when this method is used as interaction response and takes the same arguments as
ComponentContext.edit()
- प्रदत्त :
The modified Message
- प्रदत्त प्रकार :
- property custom_id: str | None#
The custom ID of the interacted component.
- प्रदत्त प्रकार :
Optional[str]
- property component: Button | SelectMenu | None#
संस्करण 4.4.0 से नया .
The component that you interacted.
- प्रदत्त प्रकार :
Optional[Union[Button, SelectMenu]]
- property channel: Channel | None#
संस्करण 4.1.0 से नया .
संस्करण 4.4.0 से अलग : Channel now returns
Noneinstead ofMISSINGif it is not found to avoid confusionReturns the current channel, if cached.
- async defer(ephemeral=False, edit_origin=False)#
संस्करण 4.4.0 से अलग : Now returns the created message object
This "defers" an interaction response, allowing up to a 15-minute delay between invocation and responding.
- property deferred_ephemeral: bool#
संस्करण 4.4.0 से नया .
Returns whether the current interaction was deferred ephemerally.
- async delete()#
This deletes the interaction response of a message sent by the contextually derived information from this class.
टिप्पणी
Doing this will proceed in the context message no longer being present.
- async get_channel()#
संस्करण 4.1.0 से नया .
This gets the channel the context was invoked in. If the channel is not cached, an HTTP request is made.
- प्रदत्त :
The channel as object
- प्रदत्त प्रकार :
- async get_guild()#
संस्करण 4.1.0 से नया .
This gets the guild the context was invoked in. If the guild is not cached, an HTTP request is made.
- प्रदत्त :
The guild as object
- प्रदत्त प्रकार :
- property guild: Guild | None#
संस्करण 4.1.0 से नया .
संस्करण 4.4.0 से अलग : Guild now returns
Noneinstead ofMISSINGif it is not found to avoid confusionReturns the current guild, if cached.
- async has_permissions(*permissions, operator='and')#
संस्करण 4.3.2 से नया .
Returns whether the author of the interaction has the permissions in the given context.
- मापदण्ड:
*permissions (Union[int, Permissions]) -- The list of permissions
operator (Optional[str]) -- The operator to use to calculate permissions. Possible values:
and,or. Defaults toand.
- प्रदत्त :
Whether the author has the permissions
- प्रदत्त प्रकार :