Interface IDiscordInteraction
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Represents a discord interaction.
public interface IDiscordInteraction : ISnowflakeEntity, IEntity<ulong>
- Inherited Members
- Extension Methods
Properties
ApplicationId
Gets the ID of the application this interaction is for.
ulong ApplicationId { get; }
Property Value
AttachmentSizeLimit
Gets the attachment size limit in bytes.
ulong AttachmentSizeLimit { get; }
Property Value
ChannelId
Gets the ID of the channel this interaction was executed in.
ulong? ChannelId { get; }
Property Value
Remarks
This property returns null if the interaction is a REST ping interaction.
ContextType
Gets the context this interaction was created in. null if context type is unknown.
InteractionContextType? ContextType { get; }
Property Value
Data
Gets the data sent within this interaction.
IDiscordInteractionData Data { get; }
Property Value
Entitlements
Gets entitlements for the invoking user.
IReadOnlyCollection<IEntitlement> Entitlements { get; }
Property Value
GuildId
Gets the ID of the guild this interaction was executed in.
ulong? GuildId { get; }
Property Value
Remarks
This property returns null if the interaction was not executed in a guild.
GuildLocale
Gets the preferred locale of the guild this interaction was executed in. null if not executed in a guild.
string GuildLocale { get; }
Property Value
Remarks
Non-community guilds (With no locale setting available) will have en-US as the default value sent by Discord.
HasResponded
Gets whether or not this interaction has been responded to.
bool HasResponded { get; }
Property Value
Remarks
This property is locally set -- if you're running multiple bots off the same token then this property won't be in sync with them.
Id
Gets the id of the interaction.
ulong Id { get; }
Property Value
IntegrationOwners
Gets which integrations authorized the interaction.
IReadOnlyDictionary<ApplicationIntegrationType, ulong> IntegrationOwners { get; }
Property Value
IsDMInteraction
Gets whether or not this interaction was executed in a dm channel.
bool IsDMInteraction { get; }
Property Value
Permissions
Gets the permissions the app or bot has within the channel the interaction was sent from.
GuildPermissions Permissions { get; }
Property Value
Token
Gets the continuation token for responding to the interaction.
string Token { get; }
Property Value
Type
Gets the type of this IDiscordInteraction.
InteractionType Type { get; }
Property Value
User
Gets the user who invoked the interaction.
IUser User { get; }
Property Value
UserLocale
Gets the preferred locale of the invoking User.
string UserLocale { get; }
Property Value
Remarks
This property returns null if the interaction is a REST ping interaction.
Version
Gets the version of the interaction, always 1.
int Version { get; }
Property Value
Methods
DeferAsync(bool, RequestOptions)
Acknowledges this interaction.
Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
Parameters
ephemeralbooloptionsRequestOptions
Returns
- Task
A task that represents the asynchronous operation of deferring the interaction.
DeleteOriginalResponseAsync(RequestOptions)
Deletes the original response to this interaction.
Task DeleteOriginalResponseAsync(RequestOptions options = null)
Parameters
optionsRequestOptionsThe request options for this async request.
Returns
- Task
A task that represents an asynchronous deletion operation.
FollowupAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Sends a followup message for this interaction.
Task<IUserMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task<IUserMessage>
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
FollowupWithFileAsync(FileAttachment, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Sends a followup message for this interaction.
Task<IUserMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
attachmentFileAttachmentThe attachment containing the file and description.
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task<IUserMessage>
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
FollowupWithFileAsync(Stream, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Sends a followup message for this interaction.
Task<IUserMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
fileStreamStreamThe file to upload.
fileNamestringThe file name of the attachment.
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task<IUserMessage>
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
FollowupWithFileAsync(string, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Sends a followup message for this interaction.
Task<IUserMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
filePathstringThe file to upload.
fileNamestringThe file name of the attachment.
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task<IUserMessage>
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
FollowupWithFilesAsync(IEnumerable<FileAttachment>, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Sends a followup message for this interaction.
Task<IUserMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
attachmentsIEnumerable<FileAttachment>A collection of attachments to upload.
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task<IUserMessage>
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
GetOriginalResponseAsync(RequestOptions)
Gets the original response for this interaction.
Task<IUserMessage> GetOriginalResponseAsync(RequestOptions options = null)
Parameters
optionsRequestOptionsThe request options for this async request.
Returns
- Task<IUserMessage>
A IUserMessage that represents the initial response.
ModifyOriginalResponseAsync(Action<MessageProperties>, RequestOptions)
Edits original response for this interaction.
Task<IUserMessage> ModifyOriginalResponseAsync(Action<MessageProperties> func, RequestOptions options = null)
Parameters
funcAction<MessageProperties>A delegate containing the properties to modify the message with.
optionsRequestOptionsThe request options for this async request.
Returns
- Task<IUserMessage>
A task that represents an asynchronous modification operation. The task result contains the updated message.
RespondAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Responds to an Interaction with type ChannelMessageWithSource.
Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task
A task that represents an asynchronous send operation for delivering the message.
RespondWithFileAsync(FileAttachment, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Responds to this interaction with a file attachment.
Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
attachmentFileAttachmentThe attachment containing the file and description.
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
RespondWithFileAsync(Stream, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Responds to this interaction with a file attachment.
Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
fileStreamStreamThe file to upload.
fileNamestringThe file name of the attachment.
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
RespondWithFileAsync(string, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Responds to this interaction with a file attachment.
Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
filePathstringThe file to upload.
fileNamestringThe file name of the attachment.
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
RespondWithFilesAsync(IEnumerable<FileAttachment>, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Responds to this interaction with a collection of file attachments.
Task RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null, MessageFlags flags = MessageFlags.None)
Parameters
attachmentsIEnumerable<FileAttachment>A collection of attachments to upload.
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
optionsRequestOptionsThe request options for this response.
pollPollPropertiesA poll to send with the message.
flagsMessageFlags
Returns
- Task
A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.
RespondWithModalAsync(Modal, RequestOptions)
Responds to the interaction with a modal.
Task RespondWithModalAsync(Modal modal, RequestOptions options = null)
Parameters
modalModalThe modal to respond with.
optionsRequestOptionsThe request options for this async request.
Returns
- Task
A task that represents the asynchronous operation of responding to the interaction.
RespondWithPremiumRequiredAsync(RequestOptions)
Responds to the interaction with an ephemeral message the invoking user, instructing them that whatever they tried to do requires the premium benefits of your app.
Task RespondWithPremiumRequiredAsync(RequestOptions options = null)
Parameters
optionsRequestOptions
Returns
- Task
A task that represents the asynchronous operation of responding to the interaction.