Class RestMessageComponent
Represents a REST-based message component.
Implements
Inherited Members
Namespace: Discord.Rest
Assembly: Discord.Net.Rest.dll
Syntax
public class RestMessageComponent : RestInteraction, 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 RestMessageComponentData Data { get; }
Property Value
Type | Description |
---|---|
RestMessageComponentData |
Message
Gets the message that contained the trigger for this interaction.
Declaration
public RestUserMessage Message { get; }
Property Value
Type | Description |
---|---|
RestUserMessage |
Methods
| Improve this Doc View SourceDefer(Boolean, RequestOptions)
Declaration
public override string Defer(bool ephemeral = false, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | ephemeral | |
RequestOptions | options |
Returns
Type | Description |
---|---|
String | A string that contains json to write back to the incoming http request. |
Overrides
| Improve this Doc View SourceDeferLoading(Boolean, RequestOptions)
Defers an interaction and responds with type 5 (DeferredChannelMessageWithSource)
Declaration
public string DeferLoading(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 |
---|---|
String | A string that contains json to write back to the incoming http request. |
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> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Overrides
| Improve this Doc View SourceFollowupWithFileAsync(FileAttachment, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
FileAttachment | attachment | The attachment containing the file and 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> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Overrides
| Improve this Doc View SourceFollowupWithFileAsync(Stream, String, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
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, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | fileStream | The file to upload. |
String | fileName | The file name of the attachment. |
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 SourceFollowupWithFileAsync(String, String, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Sends a followup message for this interaction.
Declaration
public override async 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)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | The file to upload. |
String | fileName | The file name of the attachment. |
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 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 SourceRespond(String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
Responds to an Interaction with type ChannelMessageWithSource.
Declaration
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)
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 |
---|---|
String | A string that contains json to write back to the incoming http request. |
Overrides
| Improve this Doc View SourceRespondWithModal(Modal, RequestOptions)
Responds to the interaction with a modal.
Declaration
public override string RespondWithModal(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 |
---|---|
String | A string that contains json to write back to the incoming http request. |
Overrides
| Improve this Doc View SourceUpdate(Action<MessageProperties>, RequestOptions)
Updates the message which this component resides in with the type UpdateMessage
Declaration
public string Update(Action<MessageProperties> func, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Action<MessageProperties> | func | A delegate containing the properties to modify the message with. |
RequestOptions | options | The request options for this async request. |
Returns
Type | Description |
---|---|
String | A string that contains json to write back to the incoming http request. |
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 |