Skip to main content

Interface IRestMessageChannel

Represents a REST-based channel that can send and receive messages.

Assembly: Discord.Net.Rest.dll​
View Source​
Declaration
public interface IRestMessageChannel : IMessageChannel, IChannel, ISnowflakeEntity, IEntity<ulong>

Methods​

SendMessageAsync(String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])​

Sends a message to this message channel.

View Source​
Declaration
Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null)
Returns​

System.Threading.Tasks.Task<Discord.Rest.RestUserMessage>: A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.

Parameters​
TypeNameDescription
System.StringtextThe message to be sent.
System.BooleanisTTSDetermines whether the message should be read aloud by Discord or not.
Discord.EmbedembedThe Discord.EmbedType.Rich Discord.Embed to be sent.
Discord.RequestOptionsoptionsThe options to be used when sending the request.
Discord.AllowedMentionsallowedMentions

Specifies if notifications are sent for mentioned users and roles in the message <code data-dev-comment-type="paramref" class="paramref">text</code>. If null, all mentioned roles and users will be notified. | | Discord.MessageReference | messageReference | The message references to be included. Used to reply to specific messages. | | Discord.MessageComponent | component | The message components to be included with this message. Used for interactions. | | Discord.ISticker[] | stickers | A collection of stickers to send with the message. | | Discord.Embed[] | embeds | A array of Discord.Embeds to send with this response. Max 10. |

SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])​

Sends a file to this message channel with an optional caption.

View Source​
Declaration
Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null)
Returns​

System.Threading.Tasks.Task<Discord.Rest.RestUserMessage>: A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.

Parameters​
TypeNameDescription
System.StringfilePathThe file path of the file.
System.StringtextThe message to be sent.
System.BooleanisTTSWhether the message should be read aloud by Discord or not.
Discord.EmbedembedThe Discord.EmbedType.Rich Discord.Embed to be sent.
Discord.RequestOptionsoptionsThe options to be used when sending the request.
System.BooleanisSpoilerWhether the message attachment should be hidden as a spoiler.
Discord.AllowedMentionsallowedMentions

Specifies if notifications are sent for mentioned users and roles in the message <code data-dev-comment-type="paramref" class="paramref">text</code>. If null, all mentioned roles and users will be notified. | | Discord.MessageReference | messageReference | The message references to be included. Used to reply to specific messages. | | Discord.MessageComponent | component | The message components to be included with this message. Used for interactions. | | Discord.ISticker[] | stickers | A collection of stickers to send with the message. | | Discord.Embed[] | embeds | A array of Discord.Embeds to send with this response. Max 10. |

SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])​

Sends a file to this message channel with an optional caption.

View Source​
Declaration
Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null)
Returns​

System.Threading.Tasks.Task<Discord.Rest.RestUserMessage>: A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.

Parameters​
TypeNameDescription
System.IO.StreamstreamThe System.IO.Stream of the file to be sent.
System.StringfilenameThe name of the attachment.
System.StringtextThe message to be sent.
System.BooleanisTTSWhether the message should be read aloud by Discord or not.
Discord.EmbedembedThe Discord.EmbedType.Rich Discord.Embed to be sent.
Discord.RequestOptionsoptionsThe options to be used when sending the request.
System.BooleanisSpoilerWhether the message attachment should be hidden as a spoiler.
Discord.AllowedMentionsallowedMentions

Specifies if notifications are sent for mentioned users and roles in the message <code data-dev-comment-type="paramref" class="paramref">text</code>. If null, all mentioned roles and users will be notified. | | Discord.MessageReference | messageReference | The message references to be included. Used to reply to specific messages. | | Discord.MessageComponent | component | The message components to be included with this message. Used for interactions. | | Discord.ISticker[] | stickers | A collection of stickers to send with the message. | | Discord.Embed[] | embeds | A array of Discord.Embeds to send with this response. Max 10. |

GetMessageAsync(UInt64, RequestOptions)​

Gets a message from this message channel.

View Source​
Declaration
Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.Rest.RestMessage>: A task that represents an asynchronous get operation for retrieving the message. The task result contains the retrieved message; null if no message is found with the specified identifier.

Parameters​
TypeNameDescription
System.UInt64idThe snowflake identifier of the message.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetMessagesAsync(Int32, RequestOptions)​

Gets the last N messages from this message channel.

View Source​
Declaration
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = 100, RequestOptions options = null)
Returns​

System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<Discord.Rest.RestMessage>>: Paged collection of messages.

Parameters​
TypeNameDescription
System.Int32limitThe numbers of message to be gotten from.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetMessagesAsync(UInt64, Direction, Int32, RequestOptions)​

Gets a collection of messages in this channel.

View Source​
Declaration
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = 100, RequestOptions options = null)
Returns​

System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<Discord.Rest.RestMessage>>: Paged collection of messages.

Parameters​
TypeNameDescription
System.UInt64fromMessageIdThe ID of the starting message to get the messages from.
Discord.DirectiondirThe direction of the messages to be gotten from.
System.Int32limitThe numbers of message to be gotten from.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetMessagesAsync(IMessage, Direction, Int32, RequestOptions)​

Gets a collection of messages in this channel.

View Source​
Declaration
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = 100, RequestOptions options = null)
Returns​

System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<Discord.Rest.RestMessage>>: Paged collection of messages.

Parameters​
TypeNameDescription
Discord.IMessagefromMessageThe starting message to get the messages from.
Discord.DirectiondirThe direction of the messages to be gotten from.
System.Int32limitThe numbers of message to be gotten from.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetPinnedMessagesAsync(RequestOptions)​

Gets a collection of pinned messages in this channel.

View Source​
Declaration
Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.Rest.RestMessage>>: A task that represents the asynchronous get operation for retrieving pinned messages in this channel. The task result contains a collection of messages found in the pinned messages.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.