Class SocketMessageComponent
Represents a Websocket-based interaction type for Message Components.
Implements
Inherited Members
Namespace: Discord.WebSocket
Assembly: Discord.Net.WebSocket.dll
Syntax
public class SocketMessageComponent : SocketInteraction, IEntity<ulong>, IComponentInteraction, IDiscordInteraction, ISnowflakeEntity, IEntity<ulong>
Properties
| Improve this Doc View SourceData
Gets the data received with this interaction, contains the button that was clicked.
Declaration
public SocketMessageComponentData Data { get; }
Property Value
Type | Description |
---|---|
SocketMessageComponentData |
HasResponded
Declaration
public override bool HasResponded { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceMessage
Gets the message that contained the trigger for this interaction.
Declaration
public SocketUserMessage Message { get; }
Property Value
Type | Description |
---|---|
SocketUserMessage |
Methods
| Improve this Doc View SourceDeferAsync(Boolean, RequestOptions)
Acknowledges this interaction.
Declaration
public override async Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | ephemeral | true to send this message ephemerally, otherwise false. |
RequestOptions | options | The request options for this async request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation of acknowledging the interaction. |
Overrides
| Improve this Doc View SourceDeferLoadingAsync(Boolean, RequestOptions)
Declaration
public async Task DeferLoadingAsync(bool ephemeral = false, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | ephemeral | |
RequestOptions | options |
Returns
Type | Description |
---|---|
Task |
FollowupAsync(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. |
Overrides
| Improve this Doc View SourceUpdateAsync(Action<MessageProperties>, RequestOptions)
Declaration
public async Task UpdateAsync(Action<MessageProperties> func, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Action<MessageProperties> | func | |
RequestOptions | options |
Returns
Type | Description |
---|---|
Task |
Explicit Interface Implementations
| Improve this Doc View SourceIComponentInteraction.Data
Gets the data received with this component interaction.
Declaration
IComponentInteractionData IComponentInteraction.Data { get; }
Returns
Type | Description |
---|---|
IComponentInteractionData |
IComponentInteraction.Message
Gets the message that contained the trigger for this interaction.
Declaration
IUserMessage IComponentInteraction.Message { get; }
Returns
Type | Description |
---|---|
IUserMessage |
IDiscordInteraction.Data
Gets the data sent within this interaction.
Declaration
IDiscordInteractionData IDiscordInteraction.Data { get; }
Returns
Type | Description |
---|---|
IDiscordInteractionData |