Search Results for

    Show / Hide Table of Contents

    Class RestMessageComponent

    Represents a REST-based message component.

    Inheritance
    Object
    RestEntity<UInt64>
    RestInteraction
    RestMessageComponent
    Implements
    IEntity<UInt64>
    IComponentInteraction
    IDiscordInteraction
    ISnowflakeEntity
    IEntity<UInt64>
    Inherited Members
    RestInteraction.Type
    RestInteraction.Token
    RestInteraction.Version
    RestInteraction.User
    RestInteraction.UserLocale
    RestInteraction.GuildLocale
    RestInteraction.CreatedAt
    RestInteraction.IsValidToken
    RestInteraction.Channel
    RestInteraction.ChannelId
    RestInteraction.Guild
    RestInteraction.GuildId
    RestInteraction.HasResponded
    RestInteraction.IsDMInteraction
    RestInteraction.ApplicationId
    RestInteraction.GetChannelAsync(RequestOptions)
    RestInteraction.GetGuildAsync(RequestOptions)
    RestInteraction.GetOriginalResponseAsync(RequestOptions)
    RestInteraction.ModifyOriginalResponseAsync(Action<MessageProperties>, RequestOptions)
    RestInteraction.DeleteOriginalResponseAsync(RequestOptions)
    RestInteraction.IDiscordInteraction.User
    RestEntity<UInt64>.Id
    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 Source

    Data

    Gets the data received with this interaction, contains the button that was clicked.

    Declaration
    public RestMessageComponentData Data { get; }
    Property Value
    Type Description
    RestMessageComponentData
    | Improve this Doc View Source

    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 Source

    Defer(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
    RestInteraction.Defer(Boolean, RequestOptions)
    | Improve this Doc View Source

    DeferLoading(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.

    | Improve this Doc View Source

    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
    RestInteraction.FollowupAsync(String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
    | Improve this Doc View Source

    FollowupWithFileAsync(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
    RestInteraction.FollowupWithFileAsync(FileAttachment, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
    | Improve this Doc View Source

    FollowupWithFileAsync(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
    RestInteraction.FollowupWithFileAsync(Stream, String, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
    | Improve this Doc View Source

    FollowupWithFileAsync(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
    RestInteraction.FollowupWithFileAsync(String, String, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
    | Improve this Doc View Source

    FollowupWithFilesAsync(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
    RestInteraction.FollowupWithFilesAsync(IEnumerable<FileAttachment>, String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
    | Improve this Doc View Source

    Respond(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
    RestInteraction.Respond(String, Embed[], Boolean, Boolean, AllowedMentions, MessageComponent, Embed, RequestOptions)
    | Improve this Doc View Source

    RespondWithModal(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
    RestInteraction.RespondWithModal(Modal, RequestOptions)
    | Improve this Doc View Source

    Update(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 Source

    IComponentInteraction.Data

    Gets the data received with this component interaction.

    Declaration
    IComponentInteractionData IComponentInteraction.Data { get; }
    Returns
    Type Description
    IComponentInteractionData
    | Improve this Doc View Source

    IComponentInteraction.Message

    Gets the message that contained the trigger for this interaction.

    Declaration
    IUserMessage IComponentInteraction.Message { get; }
    Returns
    Type Description
    IUserMessage

    Implements

    IEntity<TId>
    IComponentInteraction
    IDiscordInteraction
    ISnowflakeEntity
    IEntity<TId>

    Extension Methods

    RestExtensions.RespondWithModal<T>(RestInteraction, String, RequestOptions, Action<ModalBuilder>)

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2022 3.7.2