Class RestGroupChannel
Represents a REST-based group-message channel.
Implements
Inherited Members
Namespace: Discord.Rest
Assembly: Discord.Net.Rest.dll
Syntax
public class RestGroupChannel : RestChannel, IUpdateable, IGroupChannel, IRestPrivateChannel, IPrivateChannel, IRestMessageChannel, IMessageChannel, IRestAudioChannel, IAudioChannel, IChannel, ISnowflakeEntity, IEntity<ulong>
Properties
| Improve this Doc View SourceName
Gets the name of this channel.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| System.String | A string containing the name of this channel. |
Recipients
Declaration
public IReadOnlyCollection<RestGroupUser> Recipients { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<RestGroupUser> |
Users
Declaration
public IReadOnlyCollection<RestGroupUser> Users { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<RestGroupUser> |
Methods
| Improve this Doc View SourceDeleteMessageAsync(IMessage, RequestOptions)
Deletes a message based on the provided message in this channel.
Declaration
public Task DeleteMessageAsync(IMessage message, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message that would be removed. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous removal operation. |
DeleteMessageAsync(UInt64, RequestOptions)
Deletes a message.
Declaration
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | messageId | The snowflake identifier of the message that would be removed. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous removal operation. |
EnterTypingState(RequestOptions)
Continuously broadcasts the "user is typing" message to all users in this channel until the returned object is disposed.
Declaration
public IDisposable EnterTypingState(RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.IDisposable | A disposable object that, upon its disposal, will stop the client from broadcasting its typing state in this channel. |
GetMessageAsync(UInt64, RequestOptions)
Gets a message from this message channel.
Declaration
public 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
public 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
public 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
public 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
public 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.
GetUser(UInt64)
Declaration
public RestUser GetUser(ulong id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id |
Returns
| Type | Description |
|---|---|
| RestUser |
LeaveAsync(RequestOptions)
Leaves this group.
Declaration
public Task LeaveAsync(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 | A task that represents the asynchronous leave operation. |
SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)
Sends a file to this message channel with an optional caption.
Declaration
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, 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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Message content is too long, length must be less or equal to MaxMessageSize. |
SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)
Sends a file to this message channel with an optional caption.
Declaration
public Task<RestUserMessage> SendFileAsync(string filePath, string text, 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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException |
|
| System.ArgumentNullException |
|
| System.IO.PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. |
| System.IO.DirectoryNotFoundException | The specified path is invalid, (for example, it is on an unmapped drive). |
| System.UnauthorizedAccessException |
|
| System.IO.FileNotFoundException | The file specified in |
| System.NotSupportedException |
|
| System.IO.IOException | An I/O error occurred while opening the file. |
| System.ArgumentOutOfRangeException | Message content is too long, length must be less or equal to MaxMessageSize. |
SendMessageAsync(String, Boolean, Embed, RequestOptions)
Sends a message to this message channel.
Declaration
public 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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Message content is too long, length must be less or equal to MaxMessageSize. |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
TriggerTypingAsync(RequestOptions)
Broadcasts the "user is typing" message to all users in this channel, lasting 10 seconds.
Declaration
public Task TriggerTypingAsync(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 | A task that represents the asynchronous operation that triggers the broadcast. |
UpdateAsync(RequestOptions)
Updates this object's properties with its current state.
Declaration
public override Task UpdateAsync(RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIAudioChannel.ConnectAsync(Boolean, Boolean, Boolean)
Connects to this audio channel.
Declaration
Task<IAudioClient> IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | selfDeaf | Determines whether the client should deaf itself upon connection. |
| System.Boolean | selfMute | Determines whether the client should mute itself upon connection. |
| System.Boolean | external | Determines whether the audio client is an external one or not. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IAudioClient> | A task representing the asynchronous connection operation. The task result contains the IAudioClient responsible for the connection. |
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | Connecting to a group channel is not supported. |
IAudioChannel.DisconnectAsync()
Declaration
Task IAudioChannel.DisconnectAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
IChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)
Declaration
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | |
| CacheMode | mode | |
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IUser> |
IChannel.GetUsersAsync(CacheMode, RequestOptions)
Declaration
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| CacheMode | mode | |
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IUser>> |
IMessageChannel.GetMessageAsync(UInt64, CacheMode, RequestOptions)
Declaration
Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | |
| CacheMode | mode | |
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IMessage> |
IMessageChannel.GetMessagesAsync(IMessage, Direction, Int32, CacheMode, RequestOptions)
Declaration
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | fromMessage | |
| Direction | dir | |
| System.Int32 | limit | |
| CacheMode | mode | |
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>> |
IMessageChannel.GetMessagesAsync(Int32, CacheMode, RequestOptions)
Declaration
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | limit | |
| CacheMode | mode | |
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>> |
IMessageChannel.GetMessagesAsync(UInt64, Direction, Int32, CacheMode, RequestOptions)
Declaration
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | fromMessageId | |
| Direction | dir | |
| System.Int32 | limit | |
| CacheMode | mode | |
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>> |
IMessageChannel.GetPinnedMessagesAsync(RequestOptions)
Declaration
Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IMessage>> |
IMessageChannel.SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)
Declaration
Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | |
| System.String | filename | |
| System.String | text | |
| System.Boolean | isTTS | |
| Embed | embed | |
| RequestOptions | options | |
| System.Boolean | isSpoiler |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IUserMessage> |
IMessageChannel.SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)
Declaration
Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | |
| System.String | text | |
| System.Boolean | isTTS | |
| Embed | embed | |
| RequestOptions | options | |
| System.Boolean | isSpoiler |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IUserMessage> |
IMessageChannel.SendMessageAsync(String, Boolean, Embed, RequestOptions)
Declaration
Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | |
| System.Boolean | isTTS | |
| Embed | embed | |
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IUserMessage> |
IPrivateChannel.Recipients
Declaration
IReadOnlyCollection<IUser> IPrivateChannel.Recipients { get; }
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<IUser> |
IRestPrivateChannel.Recipients
Declaration
IReadOnlyCollection<RestUser> IRestPrivateChannel.Recipients { get; }
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<RestUser> |