Class RestCommandBase
Represents a REST-based base command interaction.
public class RestCommandBase : RestInteraction, IDiscordInteraction, ISnowflakeEntity, IEntity<ulong>- Inheritance
- 
      
      
      
      RestCommandBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
CommandId
Gets the id of the invoked command.
public ulong CommandId { get; }Property Value
CommandName
Gets the name of the invoked command.
public string CommandName { get; }Property Value
Methods
Defer(bool, RequestOptions)
Acknowledges this interaction with the DeferredChannelMessageWithSource.
public override string Defer(bool ephemeral = false, RequestOptions options = null)Parameters
- ephemeralbool
- optionsRequestOptions
Returns
- string
- A string that contains json to write back to the incoming http request. 
FollowupAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Sends a followup message for this interaction.
public override Task<RestFollowupMessage> 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
- textstring
- The text of the message to be sent. 
- embedsEmbed[]
- A array of embeds to send with this response. Max 10. 
- isTTSbool
- true if the message should be read out by a text-to-speech reader, otherwise false. 
- ephemeralbool
- true if the response should be hidden to everyone besides the invoker of the command, otherwise false. 
- allowedMentionsAllowedMentions
- The allowed mentions for this response. 
- componentsMessageComponent
- A MessageComponent to be sent with this response. 
- embedEmbed
- A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. 
- optionsRequestOptions
- The request options for this response. 
- pollPollProperties
- A poll to send with the message. 
- flagsMessageFlags
Returns
- Task<RestFollowupMessage>
- 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.
public override Task<RestFollowupMessage> 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
- attachmentFileAttachment
- The attachment containing the file and description. 
- textstring
- The text of the message to be sent. 
- embedsEmbed[]
- A array of embeds to send with this response. Max 10. 
- isTTSbool
- true if the message should be read out by a text-to-speech reader, otherwise false. 
- ephemeralbool
- true if the response should be hidden to everyone besides the invoker of the command, otherwise false. 
- allowedMentionsAllowedMentions
- The allowed mentions for this response. 
- componentsMessageComponent
- A MessageComponent to be sent with this response. 
- embedEmbed
- A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. 
- optionsRequestOptions
- The request options for this response. 
- pollPollProperties
- A poll to send with the message. 
- flagsMessageFlags
Returns
- Task<RestFollowupMessage>
- 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.
public override Task<RestFollowupMessage> 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
- fileStreamStream
- The file to upload. 
- fileNamestring
- The file name of the attachment. 
- textstring
- The text of the message to be sent. 
- embedsEmbed[]
- A array of embeds to send with this response. Max 10. 
- isTTSbool
- true if the message should be read out by a text-to-speech reader, otherwise false. 
- ephemeralbool
- true if the response should be hidden to everyone besides the invoker of the command, otherwise false. 
- allowedMentionsAllowedMentions
- The allowed mentions for this response. 
- componentsMessageComponent
- A MessageComponent to be sent with this response. 
- embedEmbed
- A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. 
- optionsRequestOptions
- The request options for this response. 
- pollPollProperties
- A poll to send with the message. 
- flagsMessageFlags
Returns
- Task<RestFollowupMessage>
- 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.
public override Task<RestFollowupMessage> 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
- filePathstring
- The file to upload. 
- fileNamestring
- The file name of the attachment. 
- textstring
- The text of the message to be sent. 
- embedsEmbed[]
- A array of embeds to send with this response. Max 10. 
- isTTSbool
- true if the message should be read out by a text-to-speech reader, otherwise false. 
- ephemeralbool
- true if the response should be hidden to everyone besides the invoker of the command, otherwise false. 
- allowedMentionsAllowedMentions
- The allowed mentions for this response. 
- componentsMessageComponent
- A MessageComponent to be sent with this response. 
- embedEmbed
- A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. 
- optionsRequestOptions
- The request options for this response. 
- pollPollProperties
- A poll to send with the message. 
- flagsMessageFlags
Returns
- Task<RestFollowupMessage>
- 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.
public override Task<RestFollowupMessage> 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. 
- textstring
- The text of the message to be sent. 
- embedsEmbed[]
- A array of embeds to send with this response. Max 10. 
- isTTSbool
- true if the message should be read out by a text-to-speech reader, otherwise false. 
- ephemeralbool
- true if the response should be hidden to everyone besides the invoker of the command, otherwise false. 
- allowedMentionsAllowedMentions
- The allowed mentions for this response. 
- componentsMessageComponent
- A MessageComponent to be sent with this response. 
- embedEmbed
- A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. 
- optionsRequestOptions
- The request options for this response. 
- pollPollProperties
- A poll to send with the message. 
- flagsMessageFlags
Returns
- Task<RestFollowupMessage>
- A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. 
Respond(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties, MessageFlags)
Responds to an Interaction with type ChannelMessageWithSource.
public override string Respond(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
- textstring
- The text of the message to be sent. 
- embedsEmbed[]
- A array of embeds to send with this response. Max 10. 
- isTTSbool
- true if the message should be read out by a text-to-speech reader, otherwise false. 
- ephemeralbool
- true if the response should be hidden to everyone besides the invoker of the command, otherwise false. 
- allowedMentionsAllowedMentions
- The allowed mentions for this response. 
- componentsMessageComponent
- A MessageComponent to be sent with this response. 
- embedEmbed
- A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. 
- optionsRequestOptions
- The request options for this response. 
- pollPollProperties
- A poll to send with the message. 
- flagsMessageFlags
Returns
- string
- A string that contains json to write back to the incoming http request. 
Exceptions
- ArgumentOutOfRangeException
- Message content is too long, length must be less or equal to MaxMessageSize. 
- InvalidOperationException
- The parameters provided were invalid or the token was invalid. 
RespondWithModal(Modal, RequestOptions)
Responds to the interaction with a modal.
public override string RespondWithModal(Modal modal, RequestOptions options = null)Parameters
- modalModal
- The modal to respond with. 
- optionsRequestOptions
- The request options for this async request. 
Returns
- string
- A string that contains json to write back to the incoming http request.