Class RestInteraction
Represents a REST-based interaction.
Assembly: Discord.Net.Rest.dll​
View Source​
public abstract class RestInteraction : RestEntity<ulong>, IDiscordInteraction, ISnowflakeEntity, IEntity<ulong>
Properties​
Type​
Gets the type of this Discord.IDiscordInteraction.
View Source​
public InteractionType Type { get; }
Data​
Gets the data sent within this interaction.
View Source​
public IDiscordInteractionData Data { get; }
Token​
Gets the continuation token for responding to the interaction.
View Source​
public string Token { get; }
Version​
Gets the version of the interaction, always 1.
View Source​
public int Version { get; }
User​
Gets the user who invoked the interaction.
View Source​
public RestUser User { get; }
CreatedAt​
Gets when the snowflake was created.
View Source​
public DateTimeOffset CreatedAt { get; }
IsValidToken​
true
if the token is valid for replying to, otherwise false
.
View Source​
public bool IsValidToken { get; }
Channel​
Gets the channel that this interaction was executed in.
View Source​
public IRestMessageChannel Channel { get; }
Guild​
Gets the guild this interaction was executed in.
View Source​
public RestGuild Guild { get; }
Methods​
Defer(Boolean, RequestOptions)​
View Source​
public abstract string Defer(bool ephemeral = false, RequestOptions options = null)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.Boolean | ephemeral |
Discord.RequestOptions | options |
FollowupAsync(String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
View Source​
public abstract Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null)
Returns​
System.Threading.Tasks.Task<Discord.Rest.RestFollowupMessage>
Parameters​
Type | Name |
---|---|
System.String | text |
Discord.Embed[] | embeds |
System.Boolean | isTTS |
System.Boolean | ephemeral |
Discord.AllowedMentions | allowedMentions |
Discord.RequestOptions | options |
Discord.MessageComponent | component |
Discord.Embed | embed |
GetOriginalResponseAsync(RequestOptions)​
Gets the original response for this interaction.
View Source​
public Task<RestInteractionMessage> GetOriginalResponseAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<Discord.Rest.RestInteractionMessage>
: A Discord.Rest.RestInteractionMessage that represents the initial response.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The request options for this async request. |
ModifyOriginalResponseAsync(Action<MessageProperties>, RequestOptions)​
Edits original response for this interaction.
View Source​
public async Task<RestInteractionMessage> ModifyOriginalResponseAsync(Action<MessageProperties> func, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<Discord.Rest.RestInteractionMessage>
: A Discord.Rest.RestInteractionMessage that represents the initial response.
Parameters​
Type | Name | Description |
---|---|---|
System.Action<Discord.MessageProperties> | func | A delegate containing the properties to modify the message with. |
Discord.RequestOptions | options | The request options for this async request. |
Respond(String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
View Source​
public abstract string Respond(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
Discord.Embed[] | embeds |
System.Boolean | isTTS |
System.Boolean | ephemeral |
Discord.AllowedMentions | allowedMentions |
Discord.RequestOptions | options |
Discord.MessageComponent | component |
Discord.Embed | embed |
FollowupWithFileAsync(Stream, String, String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
Sends a followup message for this interaction.
View Source​
public abstract Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null)
Returns​
System.Threading.Tasks.Task<Discord.Rest.RestFollowupMessage>
:
The sent message.
Parameters​
Type | Name | Description |
---|---|---|
System.IO.Stream | fileStream | The file to upload. |
System.String | fileName | The file name of the attachment. |
System.String | text | The text of the message to be sent. |
Discord.Embed[] | embeds | A array of embeds to send with this response. Max 10. |
System.Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false . |
System.Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false . |
Discord.AllowedMentions | allowedMentions | The allowed mentions for this response. |
Discord.RequestOptions | options | The request options for this response. |
Discord.MessageComponent | component | A Discord.MessageComponent to be sent with this response. |
Discord.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. |
FollowupWithFileAsync(String, String, String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
Sends a followup message for this interaction.
View Source​
public abstract Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string text = null, string fileName = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null)
Returns​
System.Threading.Tasks.Task<Discord.Rest.RestFollowupMessage>
:
The sent message.
Parameters​
Type | Name | Description |
---|---|---|
System.String | filePath | The file to upload. |
System.String | text | The text of the message to be sent. |
System.String | fileName | The file name of the attachment. |
Discord.Embed[] | embeds | A array of embeds to send with this response. Max 10. |
System.Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false . |
System.Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false . |
Discord.AllowedMentions | allowedMentions | The allowed mentions for this response. |
Discord.RequestOptions | options | The request options for this response. |
Discord.MessageComponent | component | A Discord.MessageComponent to be sent with this response. |
Discord.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. |
IDiscordInteraction.RespondAsync(String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
Responds to an Interaction with type Discord.InteractionResponseType.ChannelMessageWithSource.
View Source​
Task IDiscordInteraction.RespondAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, RequestOptions options, MessageComponent component, Embed embed)
Returns​
System.Threading.Tasks.Task
Parameters​
Type | Name | Description |
---|---|---|
System.String | text | The text of the message to be sent. |
Discord.Embed[] | embeds | A array of embeds to send with this response. Max 10. |
System.Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false . |
System.Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false . |
Discord.AllowedMentions | allowedMentions | The allowed mentions for this response. |
Discord.RequestOptions | options | The request options for this response. |
Discord.MessageComponent | component | A Discord.MessageComponent to be sent with this response. |
Discord.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. |
IDiscordInteraction.DeferAsync(Boolean, RequestOptions)​
View Source​
Task IDiscordInteraction.DeferAsync(bool ephemeral, RequestOptions options)
Returns​
System.Threading.Tasks.Task
Parameters​
Type | Name |
---|---|
System.Boolean | ephemeral |
Discord.RequestOptions | options |
IDiscordInteraction.FollowupAsync(String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
Sends a followup message for this interaction.
View Source​
async Task<IUserMessage> IDiscordInteraction.FollowupAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, RequestOptions options, MessageComponent component, Embed embed)
Returns​
System.Threading.Tasks.Task<Discord.IUserMessage>
:
The sent message.
Parameters​
Type | Name | Description |
---|---|---|
System.String | text | The text of the message to be sent. |
Discord.Embed[] | embeds | A array of embeds to send with this response. Max 10. |
System.Boolean | isTTS | true if the message should be read out by a text-to-speech reader, otherwise false . |
System.Boolean | ephemeral | true if the response should be hidden to everyone besides the invoker of the command, otherwise false . |
Discord.AllowedMentions | allowedMentions | The allowed mentions for this response. |
Discord.RequestOptions | options | The request options for this response. |
Discord.MessageComponent | component | A Discord.MessageComponent to be sent with this response. |
Discord.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. |
IDiscordInteraction.GetOriginalResponseAsync(RequestOptions)​
Gets the original response for this interaction.
View Source​
async Task<IUserMessage> IDiscordInteraction.GetOriginalResponseAsync(RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IUserMessage>
: A Discord.IUserMessage that represents the initial response.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The request options for this async request. |
IDiscordInteraction.ModifyOriginalResponseAsync(Action<MessageProperties>, RequestOptions)​
Edits original response for this interaction.
View Source​
async Task<IUserMessage> IDiscordInteraction.ModifyOriginalResponseAsync(Action<MessageProperties> func, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IUserMessage>
: A Discord.IUserMessage that represents the initial response.
Parameters​
Type | Name | Description |
---|---|---|
System.Action<Discord.MessageProperties> | func | A delegate containing the properties to modify the message with. |
Discord.RequestOptions | options | The request options for this async request. |