Class SocketCommandBase
Base class for User, Message, and Slash command interactions.
Inheritance
Inherited Members
Namespace: Discord.WebSocket
Assembly: Discord.Net.WebSocket.dll
Syntax
public class SocketCommandBase : SocketInteraction, IEntity<ulong>, IDiscordInteraction, ISnowflakeEntity, IEntity<ulong>
Properties
| Improve this Doc View SourceCommandId
Gets the id of the invoked command.
Declaration
public ulong CommandId { get; }
Property Value
Type | Description |
---|---|
UInt64 |
CommandName
Gets the name of the invoked command.
Declaration
public string CommandName { get; }
Property Value
Type | Description |
---|---|
String |
HasResponded
Declaration
public override bool HasResponded { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Methods
| Improve this Doc View SourceDeferAsync(Boolean, RequestOptions)
Acknowledges this interaction with the DeferredChannelMessageWithSource.
Declaration
public override async 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 acknowledging the interaction. |
Overrides
| Improve this Doc View SourceFollowupAsync(String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
public override async 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)
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<RestFollowupMessage> | The sent message. |
Overrides
| Improve this Doc View SourceFollowupWithFilesAsync(IEnumerable<FileAttachment>, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
public override async 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)
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<RestFollowupMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Overrides
| Improve this Doc View SourceRespondAsync(String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Responds to an Interaction with type ChannelMessageWithSource.
Declaration
public override async 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 |
Overrides
| Improve this Doc View SourceRespondWithFilesAsync(IEnumerable<FileAttachment>, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Declaration
public override async 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 | |
String | text | |
Embed[] | embeds | |
Boolean | isTTS | |
Boolean | ephemeral | |
AllowedMentions | allowedMentions | |
MessageComponent | components | |
Embed | embed | |
RequestOptions | options |
Returns
Type | Description |
---|---|
Task |
Overrides
| Improve this Doc View SourceRespondWithModalAsync(Modal, RequestOptions)
Responds to this interaction with a Modal.
Declaration
public override async 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. |