Interface IDiscordInteraction
Represents a discord interaction.
Inherited Members
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public interface IDiscordInteraction : ISnowflakeEntity, IEntity<ulong>
Properties
| Improve this Doc View SourceApplicationId
Gets the ID of the application this interaction is for.
Declaration
ulong ApplicationId { get; }
Property Value
Type | Description |
---|---|
UInt64 |
ChannelId
Gets the ID of the channel this interaction was executed in.
Declaration
ulong? ChannelId { get; }
Property Value
Type | Description |
---|---|
Nullable<UInt64> |
Remarks
This property returns null if the interaction is a REST ping interaction.
Data
Gets the data sent within this interaction.
Declaration
IDiscordInteractionData Data { get; }
Property Value
Type | Description |
---|---|
IDiscordInteractionData |
GuildId
Gets the ID of the guild this interaction was executed in.
Declaration
ulong? GuildId { get; }
Property Value
Type | Description |
---|---|
Nullable<UInt64> |
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.
Declaration
string GuildLocale { get; }
Property Value
Type | Description |
---|---|
String |
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.
Declaration
bool HasResponded { get; }
Property Value
Type | Description |
---|---|
Boolean |
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.
Declaration
ulong Id { get; }
Property Value
Type | Description |
---|---|
UInt64 |
IsDMInteraction
Gets whether or not this interaction was executed in a dm channel.
Declaration
bool IsDMInteraction { get; }
Property Value
Type | Description |
---|---|
Boolean |
Token
Gets the continuation token for responding to the interaction.
Declaration
string Token { get; }
Property Value
Type | Description |
---|---|
String |
Type
Gets the type of this IDiscordInteraction.
Declaration
InteractionType Type { get; }
Property Value
Type | Description |
---|---|
InteractionType |
User
Gets the user who invoked the interaction.
Declaration
IUser User { get; }
Property Value
Type | Description |
---|---|
IUser |
UserLocale
Gets the preferred locale of the invoking User.
Declaration
string UserLocale { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
This property returns null if the interaction is a REST ping interaction.
Version
Gets the version of the interaction, always 1.
Declaration
int Version { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceDeferAsync(Boolean, RequestOptions)
Acknowledges this interaction.
Declaration
Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | ephemeral | |
RequestOptions | options |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation of deferring the interaction. |
DeleteOriginalResponseAsync(RequestOptions)
Deletes the original response to this interaction.
Declaration
Task DeleteOriginalResponseAsync(RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
RequestOptions | options | The request options for this async request. |
Returns
Type | Description |
---|---|
Task | A task that represents an asynchronous deletion operation. |
FollowupAsync(String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
FileAttachment | attachment | The attachment containing the file and description. |
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
Stream | fileStream | The file to upload. |
String | fileName | The file name of the attachment. |
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | The file to upload. |
String | fileName | The file name of the attachment. |
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<FileAttachment> | attachments | A collection of attachments to upload. |
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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.
Declaration
Task<IUserMessage> GetOriginalResponseAsync(RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
RequestOptions | options | The request options for this async request. |
Returns
Type | Description |
---|---|
Task<IUserMessage> | A IUserMessage that represents the initial response. |
ModifyOriginalResponseAsync(Action<MessageProperties>, RequestOptions)
Edits original response for this interaction.
Declaration
Task<IUserMessage> ModifyOriginalResponseAsync(Action<MessageProperties> func, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Action<MessageProperties> | func | A delegate containing the properties to modify the message with. |
RequestOptions | options | The request options for this async request. |
Returns
Type | Description |
---|---|
Task<IUserMessage> | A task that represents an asynchronous modification operation. The task result contains the updated message. |
RespondAsync(String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Responds to an Interaction with type ChannelMessageWithSource.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
Task | A task that represents an asynchronous send operation for delivering the message. |
RespondWithFileAsync(FileAttachment, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Responds to this interaction with a file attachment.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
FileAttachment | attachment | The attachment containing the file and description. |
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Responds to this interaction with a file attachment.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
Stream | fileStream | The file to upload. |
String | fileName | The file name of the attachment. |
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Responds to this interaction with a file attachment.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | The file to upload. |
String | fileName | The file name of the attachment. |
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Responds to this interaction with a collection of file attachments.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<FileAttachment> | attachments | A collection of attachments to upload. |
String | text | The text of the message to be sent. |
Embed[] | embeds | A array of embeds to send with this response. Max 10. |
Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false. |
Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false. |
AllowedMentions | allowedMentions | The allowed mentions for this response. |
MessageComponent | components | A MessageComponent to be sent with this response. |
Embed | embed | A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. |
RequestOptions | options | The request options for this response. |
Returns
Type | Description |
---|---|
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.
Declaration
Task RespondWithModalAsync(Modal modal, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Modal | modal | The modal to respond with. |
RequestOptions | options | The request options for this async request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation of responding to the interaction. |