Interface IRestMessageChannel
Represents a REST-based channel that can send and receive messages.
Inherited Members
Namespace: Discord.Rest
Assembly: Discord.Net.Rest.dll
Syntax
public interface IRestMessageChannel : IMessageChannel, IChannel, ISnowflakeEntity, IEntity<ulong>
Methods
| Improve this Doc View SourceGetMessageAsync(UInt64, RequestOptions)
Gets a message from this message channel.
Declaration
Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | The snowflake identifier of the message. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<RestMessage> | A task that represents an asynchronous get operation for retrieving the message. The task result contains
the retrieved message; |
Remarks
This method follows the same behavior as described in GetMessageAsync(UInt64, CacheMode, RequestOptions). Please visit its documentation for more details on this method.
GetMessagesAsync(IMessage, Direction, Int32, RequestOptions)
Gets a collection of messages in this channel.
Declaration
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = 100, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | fromMessage | The starting message to get the messages from. |
| Direction | dir | The direction of the messages to be gotten from. |
| System.Int32 | limit | The numbers of message to be gotten from. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<RestMessage>> | Paged collection of messages. |
Remarks
This method follows the same behavior as described in GetMessagesAsync(IMessage, Direction, Int32, CacheMode, RequestOptions). Please visit its documentation for more details on this method.
GetMessagesAsync(Int32, RequestOptions)
Gets the last N messages from this message channel.
Declaration
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = 100, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | limit | The numbers of message to be gotten from. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<RestMessage>> | Paged collection of messages. |
Remarks
This method follows the same behavior as described in GetMessagesAsync(Int32, CacheMode, RequestOptions). Please visit its documentation for more details on this method.
GetMessagesAsync(UInt64, Direction, Int32, RequestOptions)
Gets a collection of messages in this channel.
Declaration
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = 100, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | fromMessageId | The ID of the starting message to get the messages from. |
| Direction | dir | The direction of the messages to be gotten from. |
| System.Int32 | limit | The numbers of message to be gotten from. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<RestMessage>> | Paged collection of messages. |
Remarks
This method follows the same behavior as described in GetMessagesAsync(UInt64, Direction, Int32, CacheMode, RequestOptions). Please visit its documentation for more details on this method.
GetPinnedMessagesAsync(RequestOptions)
Gets a collection of pinned messages in this channel.
Declaration
Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<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. |
Remarks
This method follows the same behavior as described in GetPinnedMessagesAsync(RequestOptions). Please visit its documentation for more details on this method.
SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)
Sends a file to this message channel with an optional caption.
Declaration
Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The System.IO.Stream of the file to be sent. |
| System.String | filename | The name of the attachment. |
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
| System.Boolean | isSpoiler |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<RestUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Remarks
This method follows the same behavior as described in SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean). Please visit its documentation for more details on this method.
SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)
Sends a file to this message channel with an optional caption.
Declaration
Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | The file path of the file. |
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
| System.Boolean | isSpoiler |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<RestUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Remarks
This method follows the same behavior as described in SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean). Please visit its documentation for more details on this method.
SendMessageAsync(String, Boolean, Embed, RequestOptions)
Sends a message to this message channel.
Declaration
Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Determines whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<RestUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Remarks
This method follows the same behavior as described in SendMessageAsync(String, Boolean, Embed, RequestOptions). Please visit its documentation for more details on this method.