Class SocketMessageComponent
Represents a Websocket-based interaction type for Message Components.
Assembly: Discord.Net.WebSocket.dll​
View Source​
public class SocketMessageComponent : SocketInteraction, IComponentInteraction, IDiscordInteraction, ISnowflakeEntity, IEntity<ulong>
Properties​
Data​
Gets the data received with this interaction, contains the button that was clicked.
View Source​
public SocketMessageComponentData Data { get; }
Message​
Gets the message that contained the trigger for this interaction.
View Source​
public SocketUserMessage Message { get; }
HasResponded​
View Source​
public override bool HasResponded { get; }
IComponentInteraction.Data​
Gets the data received with this interaction, contains the button that was clicked.
View Source​
IComponentInteractionData IComponentInteraction.Data { get; }
IComponentInteraction.Message​
Gets the message that contained the trigger for this interaction.
View Source​
IUserMessage IComponentInteraction.Message { get; }
IDiscordInteraction.Data​
Gets the data sent within this interaction.
View Source​
IDiscordInteractionData IDiscordInteraction.Data { get; }
Methods​
RespondAsync(String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
Responds to an Interaction with type Discord.InteractionResponseType.ChannelMessageWithSource.
View Source​
public override async Task RespondAsync(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
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. |
UpdateAsync(Action<MessageProperties>, RequestOptions)​
Updates the message which this component resides in with the type Discord.InteractionResponseType.UpdateMessage
View Source​
public async Task UpdateAsync(Action<MessageProperties> func, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
: A task that represents the asynchronous operation of updating the message.
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. |
FollowupAsync(String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
Sends a followup message for this interaction.
View Source​
public override async 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>
:
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. |
FollowupWithFileAsync(Stream, String, String, Embed[], Boolean, Boolean, AllowedMentions, RequestOptions, MessageComponent, Embed)​
Sends a followup message for this interaction.
View Source​
public override async 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 override async 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. |
DeferLoadingAsync(Boolean, RequestOptions)​
Defers an interaction and responds with type 5 (Discord.InteractionResponseType.DeferredChannelMessageWithSource)
View Source​
public async Task DeferLoadingAsync(bool ephemeral = false, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous operation of acknowledging the interaction.
Parameters​
Type | Name | Description |
---|---|---|
System.Boolean | ephemeral | true to send this message ephemerally, otherwise false . |
Discord.RequestOptions | options | The request options for this async request. |
DeferAsync(Boolean, RequestOptions)​
Acknowledges this interaction.
View Source​
public override async Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous operation of acknowledging the interaction.
Parameters​
Type | Name | Description |
---|---|---|
System.Boolean | ephemeral | true to send this message ephemerally, otherwise false . |
Discord.RequestOptions | options | The request options for this async request. |