BaseInteraction

class discord.BaseInteraction

The Base-Class for a discord-interaction like klick a Button, select (an) option(s) of SelectMenu or using an application-command in discord For more general information’s about Interactions visit the Documentation of the Discord-API

await edit(*, content=MISSING, embed=MISSING, embeds=MISSING, components=MISSING, attachments=MISSING, keep_existing_attachments=False, delete_after=None, allowed_mentions=MISSING, suppress_embeds=False)

This function is a coroutine.

Responds to the interaction by editing the original or callback message depending on the BaseInteraction.type.

Parameters:
  • content (Optional[str]) – The new content to replace the message with. Could be None to remove the content.

  • embed (Optional[Embed]) – The new embed to replace the original with. Could be None to remove all embeds.

  • embeds (Optional[List[Embed]]) –

    A list containing up to 10 embeds`to send. If None or empty, all embeds will be removed.

    If passed, embed does also count towards the limit of 10 embeds.

  • components (List[Union[ActionRow, List[Union[Button, BaseSelect]]]]) – A list of up to five Button’s or one BaseSelect like object.

  • attachments (List[Union[Attachment, File]]) –

    A list containing previous attachments to keep as well as new files to upload. You can use keep_existing_attachments to auto-add the existing attachments to the list. If None or empty, all attachments will be removed.

    Note

    New files will always appear under existing ones.

  • keep_existing_attachments (bool) –

    Whether to auto-add existing attachments to attachments, default False.

    Note

    Only needed when attachments are passed, otherwise will be ignored.

  • suppress_embeds (bool) – Whether to suppress embeds for the message. This removes all the embeds if set to True. If set to False this brings the embeds back if they were suppressed.

  • delete_after (Optional[float]) – If provided, the number of seconds to wait in the background before deleting the response we just edited. If the deletion fails, then it is silently ignored.

  • allowed_mentions (Optional[AllowedMentions]) – Controls the mentions being processed in this message. If this is passed, then the object is merged with allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in allowed_mentions. If no object is passed at all then the defaults given by allowed_mentions are used instead.

Raises:
  • TypeError – The interaction was already responded to with a modal, or it is an application-command that was not responded to.

  • NotFound: – The interaction is expired.

  • HTTPException – Editing the message failed.

Returns:

The edited message.

Return type:

Union[Message, EphemeralMessage]

await respond(content=None, *, tts=False, embed=None, embeds=None, components=None, file=None, files=None, delete_after=None, allowed_mentions=None, suppress_embeds=False, suppress_notifications=False, hidden=False)

This function is a coroutine.

Responds to an interaction by sending a message.

Parameters:
  • content (str) – The content of the message to send.

  • tts (bool) – Indicates if the message should be sent using text-to-speech.

  • embed (Embed) – The rich embed for the content.

  • embeds (List[Embed]) –

    A list containing up to 10 embeds.

    If passed, embed also counts towards the limit of 10.

  • components (List[Union[ActionRow, List[Union[Button, BaseSelect]]]]) – A list of up to five Button’s or one BaseSelect like object.

  • file (File) – The file to upload.

  • files (List[File]) – A list of files to upload. Must be a maximum of 10.

  • suppress_embeds (bool) – Whether to suppress embeds for the message.

  • suppress_notifications (bool) – Whether to suppress desktop- & push-notifications for the post starter-message.

  • delete_after (float) – If provided, the number of seconds to wait in the background before deleting the response we just sent. If the deletion fails, then it is silently ignored.

  • allowed_mentions (AllowedMentions) – Controls the mentions being processed in this message. If this is passed, then the object is merged with allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in allowed_mentions. If no object is passed at all then the defaults given by allowed_mentions are used instead.

  • hidden (Optional[bool]) – If True the message will be only visible for the performer of the interaction (e.g. author).

Raises:
  • TypeError – This interaction was already responded to with a modal.

  • NotFound – The interaction has expired.

  • HTTPException – Responding to the interaction failed.

await respond_with_modal(modal)

This function is a coroutine. Respond to an interaction with a popup modal.

Parameters:

modal (Modal) – The modal to send.

Raises:
await get_original_callback(raw=False)

This function is a coroutine. Fetch the original callback-message of the interaction.

Warning

This is an API-Call and should be used carefully

Parameters:

raw (Optional[bool]) – Whether to return the raw data from the api instead of a Message/EphemeralMessage.

Returns:

The original callback-message of the interaction.

Return type:

Union[Message,:class:EphemeralMessage], dict]

get_followup(id)

Gets a followup message of this interaction with the given id.

Parameters:

id (int) – The id of the followup message.

Returns:

The followup or None if there is none.

Return type:

Optional[Union[Message, EphemeralMessage]]

property created_at

Returns the Interaction’s creation time in UTC.

Returns:

datetime.datetime

property author

The Member that invoked the interaction. If channel is of type private or the user has left the guild, then it is a User instead.

Type:

Union[Member, User]

property channel

Union[TextChannel, ThreadChannel, DMChannel, VoiceChannel]: The channel where the interaction was invoked in.

property guild

The guild the interaction was invoked in, if there is one.

Type:

Optional[Guild]

property message_is_dm

Whether the interaction was invoked in a DMChannel.

Type:

bool

property message_is_hidden

Whether the message has the ephemeral() flag.

Type:

bool

property bot

The Client/Bot instance of the bot.

Type:

Union[Client, Bot]

ApplicationCommandInteraction

class discord.ApplicationCommandInteraction

Represents the data of an interaction that will be received when a SlashCommand, UserCommand or MessageCommand is used.

property command

The application-command that was invoked.

Type:

Optional[ApplicationCommand]

await defer(hidden=False)

Defers the interaction, the user sees a loading state

Parameters:

hidden (Optional[bool]) – Weather only the author of the command should see this

Raises:
Returns:

The Message containing the loading state

Return type:

Union[EphemeralMessage]

property author

The Member that invoked the interaction. If channel is of type private or the user has left the guild, then it is a User instead.

Type:

Union[Member, User]

property bot

The Client/Bot instance of the bot.

Type:

Union[Client, Bot]

property channel

Union[TextChannel, ThreadChannel, DMChannel, VoiceChannel]: The channel where the interaction was invoked in.

property created_at

Returns the Interaction’s creation time in UTC.

Returns:

datetime.datetime

await edit(*, content=MISSING, embed=MISSING, embeds=MISSING, components=MISSING, attachments=MISSING, keep_existing_attachments=False, delete_after=None, allowed_mentions=MISSING, suppress_embeds=False)

This function is a coroutine.

Responds to the interaction by editing the original or callback message depending on the BaseInteraction.type.

Parameters:
  • content (Optional[str]) – The new content to replace the message with. Could be None to remove the content.

  • embed (Optional[Embed]) – The new embed to replace the original with. Could be None to remove all embeds.

  • embeds (Optional[List[Embed]]) –

    A list containing up to 10 embeds`to send. If None or empty, all embeds will be removed.

    If passed, embed does also count towards the limit of 10 embeds.

  • components (List[Union[ActionRow, List[Union[Button, BaseSelect]]]]) – A list of up to five Button’s or one BaseSelect like object.

  • attachments (List[Union[Attachment, File]]) –

    A list containing previous attachments to keep as well as new files to upload. You can use keep_existing_attachments to auto-add the existing attachments to the list. If None or empty, all attachments will be removed.

    Note

    New files will always appear under existing ones.

  • keep_existing_attachments (bool) –

    Whether to auto-add existing attachments to attachments, default False.

    Note

    Only needed when attachments are passed, otherwise will be ignored.

  • suppress_embeds (bool) – Whether to suppress embeds for the message. This removes all the embeds if set to True. If set to False this brings the embeds back if they were suppressed.

  • delete_after (Optional[float]) – If provided, the number of seconds to wait in the background before deleting the response we just edited. If the deletion fails, then it is silently ignored.

  • allowed_mentions (Optional[AllowedMentions]) – Controls the mentions being processed in this message. If this is passed, then the object is merged with allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in allowed_mentions. If no object is passed at all then the defaults given by allowed_mentions are used instead.

Raises:
  • TypeError – The interaction was already responded to with a modal, or it is an application-command that was not responded to.

  • NotFound: – The interaction is expired.

  • HTTPException – Editing the message failed.

Returns:

The edited message.

Return type:

Union[Message, EphemeralMessage]

get_followup(id)

Gets a followup message of this interaction with the given id.

Parameters:

id (int) – The id of the followup message.

Returns:

The followup or None if there is none.

Return type:

Optional[Union[Message, EphemeralMessage]]

await get_original_callback(raw=False)

This function is a coroutine. Fetch the original callback-message of the interaction.

Warning

This is an API-Call and should be used carefully

Parameters:

raw (Optional[bool]) – Whether to return the raw data from the api instead of a Message/EphemeralMessage.

Returns:

The original callback-message of the interaction.

Return type:

Union[Message,:class:EphemeralMessage], dict]

property guild

The guild the interaction was invoked in, if there is one.

Type:

Optional[Guild]

property message_is_dm

Whether the interaction was invoked in a DMChannel.

Type:

bool

property message_is_hidden

Whether the message has the ephemeral() flag.

Type:

bool

await respond(content=None, *, tts=False, embed=None, embeds=None, components=None, file=None, files=None, delete_after=None, allowed_mentions=None, suppress_embeds=False, suppress_notifications=False, hidden=False)

This function is a coroutine.

Responds to an interaction by sending a message.

Parameters:
  • content (str) – The content of the message to send.

  • tts (bool) – Indicates if the message should be sent using text-to-speech.

  • embed (Embed) – The rich embed for the content.

  • embeds (List[Embed]) –

    A list containing up to 10 embeds.

    If passed, embed also counts towards the limit of 10.

  • components (List[Union[ActionRow, List[Union[Button, BaseSelect]]]]) – A list of up to five Button’s or one BaseSelect like object.

  • file (File) – The file to upload.

  • files (List[File]) – A list of files to upload. Must be a maximum of 10.

  • suppress_embeds (bool) – Whether to suppress embeds for the message.

  • suppress_notifications (bool) – Whether to suppress desktop- & push-notifications for the post starter-message.

  • delete_after (float) – If provided, the number of seconds to wait in the background before deleting the response we just sent. If the deletion fails, then it is silently ignored.

  • allowed_mentions (AllowedMentions) – Controls the mentions being processed in this message. If this is passed, then the object is merged with allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in allowed_mentions. If no object is passed at all then the defaults given by allowed_mentions are used instead.

  • hidden (Optional[bool]) – If True the message will be only visible for the performer of the interaction (e.g. author).

Raises:
  • TypeError – This interaction was already responded to with a modal.

  • NotFound – The interaction has expired.

  • HTTPException – Responding to the interaction failed.

await respond_with_modal(modal)

This function is a coroutine. Respond to an interaction with a popup modal.

Parameters:

modal (Modal) – The modal to send.

Raises:

ComponentInteraction

class discord.ComponentInteraction

Represents the data of an interaction which will be received when any BaseSelect or Button is used.

property component

The component that was used

Type:

Union[Button, SelectMenu]

await defer(type=<InteractionCallbackType.deferred_update_msg: 6>, hidden=False)

Defers the interaction.

Parameters:
  • type (Union[Literal[5, 6]]) – Use 5 to edit the original message later and 6 to let the user sees a loading state and edit it later.

  • hidden (Optional[bool]) –

    Weather only the author of the command should see this, default True

    Note

    Only for deferred_msg_with_source (5).

Raises:
Returns:

The message containing the loading-state if deferred_msg_with_source (5) is used, else None.

Return type:

Optional[Union[EphemeralMessage]]

property author

The Member that invoked the interaction. If channel is of type private or the user has left the guild, then it is a User instead.

Type:

Union[Member, User]

property bot

The Client/Bot instance of the bot.

Type:

Union[Client, Bot]

property channel

Union[TextChannel, ThreadChannel, DMChannel, VoiceChannel]: The channel where the interaction was invoked in.

property created_at

Returns the Interaction’s creation time in UTC.

Returns:

datetime.datetime

await edit(*, content=MISSING, embed=MISSING, embeds=MISSING, components=MISSING, attachments=MISSING, keep_existing_attachments=False, delete_after=None, allowed_mentions=MISSING, suppress_embeds=False)

This function is a coroutine.

Responds to the interaction by editing the original or callback message depending on the BaseInteraction.type.

Parameters:
  • content (Optional[str]) – The new content to replace the message with. Could be None to remove the content.

  • embed (Optional[Embed]) – The new embed to replace the original with. Could be None to remove all embeds.

  • embeds (Optional[List[Embed]]) –

    A list containing up to 10 embeds`to send. If None or empty, all embeds will be removed.

    If passed, embed does also count towards the limit of 10 embeds.

  • components (List[Union[ActionRow, List[Union[Button, BaseSelect]]]]) – A list of up to five Button’s or one BaseSelect like object.

  • attachments (List[Union[Attachment, File]]) –

    A list containing previous attachments to keep as well as new files to upload. You can use keep_existing_attachments to auto-add the existing attachments to the list. If None or empty, all attachments will be removed.

    Note

    New files will always appear under existing ones.

  • keep_existing_attachments (bool) –

    Whether to auto-add existing attachments to attachments, default False.

    Note

    Only needed when attachments are passed, otherwise will be ignored.

  • suppress_embeds (bool) – Whether to suppress embeds for the message. This removes all the embeds if set to True. If set to False this brings the embeds back if they were suppressed.

  • delete_after (Optional[float]) – If provided, the number of seconds to wait in the background before deleting the response we just edited. If the deletion fails, then it is silently ignored.

  • allowed_mentions (Optional[AllowedMentions]) – Controls the mentions being processed in this message. If this is passed, then the object is merged with allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in allowed_mentions. If no object is passed at all then the defaults given by allowed_mentions are used instead.

Raises:
  • TypeError – The interaction was already responded to with a modal, or it is an application-command that was not responded to.

  • NotFound: – The interaction is expired.

  • HTTPException – Editing the message failed.

Returns:

The edited message.

Return type:

Union[Message, EphemeralMessage]

get_followup(id)

Gets a followup message of this interaction with the given id.

Parameters:

id (int) – The id of the followup message.

Returns:

The followup or None if there is none.

Return type:

Optional[Union[Message, EphemeralMessage]]

await get_original_callback(raw=False)

This function is a coroutine. Fetch the original callback-message of the interaction.

Warning

This is an API-Call and should be used carefully

Parameters:

raw (Optional[bool]) – Whether to return the raw data from the api instead of a Message/EphemeralMessage.

Returns:

The original callback-message of the interaction.

Return type:

Union[Message,:class:EphemeralMessage], dict]

property guild

The guild the interaction was invoked in, if there is one.

Type:

Optional[Guild]

property message_is_dm

Whether the interaction was invoked in a DMChannel.

Type:

bool

property message_is_hidden

Whether the message has the ephemeral() flag.

Type:

bool

await respond(content=None, *, tts=False, embed=None, embeds=None, components=None, file=None, files=None, delete_after=None, allowed_mentions=None, suppress_embeds=False, suppress_notifications=False, hidden=False)

This function is a coroutine.

Responds to an interaction by sending a message.

Parameters:
  • content (str) – The content of the message to send.

  • tts (bool) – Indicates if the message should be sent using text-to-speech.

  • embed (Embed) – The rich embed for the content.

  • embeds (List[Embed]) –

    A list containing up to 10 embeds.

    If passed, embed also counts towards the limit of 10.

  • components (List[Union[ActionRow, List[Union[Button, BaseSelect]]]]) – A list of up to five Button’s or one BaseSelect like object.

  • file (File) – The file to upload.

  • files (List[File]) – A list of files to upload. Must be a maximum of 10.

  • suppress_embeds (bool) – Whether to suppress embeds for the message.

  • suppress_notifications (bool) – Whether to suppress desktop- & push-notifications for the post starter-message.

  • delete_after (float) – If provided, the number of seconds to wait in the background before deleting the response we just sent. If the deletion fails, then it is silently ignored.

  • allowed_mentions (AllowedMentions) – Controls the mentions being processed in this message. If this is passed, then the object is merged with allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in allowed_mentions. If no object is passed at all then the defaults given by allowed_mentions are used instead.

  • hidden (Optional[bool]) – If True the message will be only visible for the performer of the interaction (e.g. author).

Raises:
  • TypeError – This interaction was already responded to with a modal.

  • NotFound – The interaction has expired.

  • HTTPException – Responding to the interaction failed.

await respond_with_modal(modal)

This function is a coroutine. Respond to an interaction with a popup modal.

Parameters:

modal (Modal) – The modal to send.

Raises:

AutocompleteInteraction

class discord.AutocompleteInteraction

Represents the data of an interaction that will be received when autocomplete for a SlashCommandOption with autocomplete is set to True.

property command

The slash-command for wich autocomplete was triggered.

Type:

Optional[SlashCommand]

property focused_option

Returns the currently focused option.

Type:

InteractionDataOption

property focused_option_name

Returns the name of the currently focused option.

Type:

str

await send_choices(choices)

Respond to the interaction with the choices the user should have.

Parameters:

choices (List[SlashCommandOptionChoice]) – A list of maximum 25 options the user could choose from.

Raises:
  • ValueError – When more than 25 choices are passed.

  • discord.NotFound – You have been waited to long with responding to the interaction.

await suggest(choices)

An aliase for send_choices()

property author

The Member that invoked the interaction. If channel is of type private or the user has left the guild, then it is a User instead.

Type:

Union[Member, User]

property bot

The Client/Bot instance of the bot.

Type:

Union[Client, Bot]

property channel

Union[TextChannel, ThreadChannel, DMChannel, VoiceChannel]: The channel where the interaction was invoked in.

property created_at

Returns the Interaction’s creation time in UTC.

Returns:

datetime.datetime

await get_original_callback(raw=False)

This function is a coroutine. Fetch the original callback-message of the interaction.

Warning

This is an API-Call and should be used carefully

Parameters:

raw (Optional[bool]) – Whether to return the raw data from the api instead of a Message/EphemeralMessage.

Returns:

The original callback-message of the interaction.

Return type:

Union[Message,:class:EphemeralMessage], dict]

property guild

The guild the interaction was invoked in, if there is one.

Type:

Optional[Guild]

property message_is_dm

Whether the interaction was invoked in a DMChannel.

Type:

bool

ModalSubmitInteraction

class discord.ModalSubmitInteraction

Represents the data of an interaction that will be received when the Submit button of a Modal is pressed.

get_field(custom_id)

Optional[TextInput]: Returns the field witch custom_id match or None

property fields

List[TextInput] Returns a list containing the fields of the Modal.

property custom_id

The Custom ID of the Modal

Returns:

The custom_id of the Modal.

Return type:

str

property author

The Member that invoked the interaction. If channel is of type private or the user has left the guild, then it is a User instead.

Type:

Union[Member, User]

property bot

The Client/Bot instance of the bot.

Type:

Union[Client, Bot]

property channel

Union[TextChannel, ThreadChannel, DMChannel, VoiceChannel]: The channel where the interaction was invoked in.

property created_at

Returns the Interaction’s creation time in UTC.

Returns:

datetime.datetime

await edit(*, content=MISSING, embed=MISSING, embeds=MISSING, components=MISSING, attachments=MISSING, keep_existing_attachments=False, delete_after=None, allowed_mentions=MISSING, suppress_embeds=False)

This function is a coroutine.

Responds to the interaction by editing the original or callback message depending on the BaseInteraction.type.

Parameters:
  • content (Optional[str]) – The new content to replace the message with. Could be None to remove the content.

  • embed (Optional[Embed]) – The new embed to replace the original with. Could be None to remove all embeds.

  • embeds (Optional[List[Embed]]) –

    A list containing up to 10 embeds`to send. If None or empty, all embeds will be removed.

    If passed, embed does also count towards the limit of 10 embeds.

  • components (List[Union[ActionRow, List[Union[Button, BaseSelect]]]]) – A list of up to five Button’s or one BaseSelect like object.

  • attachments (List[Union[Attachment, File]]) –

    A list containing previous attachments to keep as well as new files to upload. You can use keep_existing_attachments to auto-add the existing attachments to the list. If None or empty, all attachments will be removed.

    Note

    New files will always appear under existing ones.

  • keep_existing_attachments (bool) –

    Whether to auto-add existing attachments to attachments, default False.

    Note

    Only needed when attachments are passed, otherwise will be ignored.

  • suppress_embeds (bool) – Whether to suppress embeds for the message. This removes all the embeds if set to True. If set to False this brings the embeds back if they were suppressed.

  • delete_after (Optional[float]) – If provided, the number of seconds to wait in the background before deleting the response we just edited. If the deletion fails, then it is silently ignored.

  • allowed_mentions (Optional[AllowedMentions]) – Controls the mentions being processed in this message. If this is passed, then the object is merged with allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in allowed_mentions. If no object is passed at all then the defaults given by allowed_mentions are used instead.

Raises:
  • TypeError – The interaction was already responded to with a modal, or it is an application-command that was not responded to.

  • NotFound: – The interaction is expired.

  • HTTPException – Editing the message failed.

Returns:

The edited message.

Return type:

Union[Message, EphemeralMessage]

get_followup(id)

Gets a followup message of this interaction with the given id.

Parameters:

id (int) – The id of the followup message.

Returns:

The followup or None if there is none.

Return type:

Optional[Union[Message, EphemeralMessage]]

await get_original_callback(raw=False)

This function is a coroutine. Fetch the original callback-message of the interaction.

Warning

This is an API-Call and should be used carefully

Parameters:

raw (Optional[bool]) – Whether to return the raw data from the api instead of a Message/EphemeralMessage.

Returns:

The original callback-message of the interaction.

Return type:

Union[Message,:class:EphemeralMessage], dict]

property guild

The guild the interaction was invoked in, if there is one.

Type:

Optional[Guild]

property message_is_dm

Whether the interaction was invoked in a DMChannel.

Type:

bool

property message_is_hidden

Whether the message has the ephemeral() flag.

Type:

bool

await respond(content=None, *, tts=False, embed=None, embeds=None, components=None, file=None, files=None, delete_after=None, allowed_mentions=None, suppress_embeds=False, suppress_notifications=False, hidden=False)

This function is a coroutine.

Responds to an interaction by sending a message.

Parameters:
  • content (str) – The content of the message to send.

  • tts (bool) – Indicates if the message should be sent using text-to-speech.

  • embed (Embed) – The rich embed for the content.

  • embeds (List[Embed]) –

    A list containing up to 10 embeds.

    If passed, embed also counts towards the limit of 10.

  • components (List[Union[ActionRow, List[Union[Button, BaseSelect]]]]) – A list of up to five Button’s or one BaseSelect like object.

  • file (File) – The file to upload.

  • files (List[File]) – A list of files to upload. Must be a maximum of 10.

  • suppress_embeds (bool) – Whether to suppress embeds for the message.

  • suppress_notifications (bool) – Whether to suppress desktop- & push-notifications for the post starter-message.

  • delete_after (float) – If provided, the number of seconds to wait in the background before deleting the response we just sent. If the deletion fails, then it is silently ignored.

  • allowed_mentions (AllowedMentions) – Controls the mentions being processed in this message. If this is passed, then the object is merged with allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in allowed_mentions. If no object is passed at all then the defaults given by allowed_mentions are used instead.

  • hidden (Optional[bool]) – If True the message will be only visible for the performer of the interaction (e.g. author).

Raises:
  • TypeError – This interaction was already responded to with a modal.

  • NotFound – The interaction has expired.

  • HTTPException – Responding to the interaction failed.

Localizations

Methods
class discord.Localizations

Represents a dict with localized values. These are used for application-commands, options and choices name_localizations and description_localizations

See Locale for a list of available locals.

Example

Localizations(
    en_US='Hello World!',
    de='Hallo Welt!',
    fr='Bonjour le monde!'
    uk='Привіт світ!'
)

Using the full language name is also possible.

Localizations(
    english_us='Hello World!',
    german='Hallo Welt!',
    french='Bonjour le monde!'
    ukrainian='Привіт світ!'
)
Parameters:

kwargs (Any) –

Keyword only arguments in format language='Value' As language you could use any of discord.Locale s members. See table above.

Note

Values follow the same restrictions as the target they are used for. e.g. description, name, etc.

update(_Localizations__m)

Similar to dict.update()

from_target(target, *, default=None)

Returns the value for the local of the object (if it’s set), or default`(:class:`None)

Parameters:
  • target (Union[Guild, BaseInteraction]) – The target witch locale to use. If it is of type BaseInteraction (or any subclass) it returns takes the local of the author.

  • default (Optional[Any]) – The value or an object to return by default if there is no value for the locale of target set. Default to None or english_US/english_GB

Returns:

The value of the locale or None if there is no value for the locale set.

Return type:

Union[str, None]

Raises:

TypeError – If target is of the wrong type.

InteractionDataOption

class discord.interactions.InteractionDataOption

Represents a slash-command option passed via a command. By default, you only get in contact with this using focused_option.

name

The name of the option

Type:

str

type

The type of the option

Type:

OptionType

property value

Returns the value of the option (what the user passed)

Type:

Union[str, int, float]

property focused

Whether this option is currently focused (for autocomplete)

Type:

bool

property options

For sub-command (groups) the sub-command or the actual options

Type:

Optional[List[InteractionDataOption]]