Class SocketGroupChannel
Represents a WebSocket-based private group channel.
Implements
Namespace: Discord.WebSocket
Assembly: Discord.Net.WebSocket.dll
Syntax
public class SocketGroupChannel : SocketChannel, IEntity<ulong>, IGroupChannel, ISocketPrivateChannel, IPrivateChannel, ISocketMessageChannel, IMessageChannel, ISocketAudioChannel, IAudioChannel, IChannel, ISnowflakeEntity, IEntity<ulong>
Properties
| Improve this Doc View SourceCachedMessages
Gets all messages in this channel's cache.
Declaration
public IReadOnlyCollection<SocketMessage> CachedMessages { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<SocketMessage> | A read-only collection of WebSocket-based messages. |
Name
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
String |
Recipients
Returns a collection representing all users in the group, not including the client.
Declaration
public IReadOnlyCollection<SocketGroupUser> Recipients { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<SocketGroupUser> |
RTCRegion
Declaration
public string RTCRegion { get; }
Property Value
Type | Description |
---|---|
String |
Users
Returns a collection representing all of the users in the group.
Declaration
public IReadOnlyCollection<SocketGroupUser> Users { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<SocketGroupUser> |
Methods
| Improve this Doc View SourceConnectAsync()
Declaration
public Task<IAudioClient> ConnectAsync()
Returns
Type | Description |
---|---|
Task<IAudioClient> |
DeleteMessageAsync(IMessage, RequestOptions)
Declaration
public Task DeleteMessageAsync(IMessage message, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | |
RequestOptions | options |
Returns
Type | Description |
---|---|
Task |
DeleteMessageAsync(UInt64, RequestOptions)
Declaration
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | messageId | |
RequestOptions | options |
Returns
Type | Description |
---|---|
Task |
EnterTypingState(RequestOptions)
Declaration
public IDisposable EnterTypingState(RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
RequestOptions | options |
Returns
Type | Description |
---|---|
IDisposable |
GetCachedMessage(UInt64)
Gets a cached message from this channel.
Declaration
public SocketMessage GetCachedMessage(ulong id)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | id | The snowflake identifier of the message. |
Returns
Type | Description |
---|---|
SocketMessage | A WebSocket-based message object; null if it does not exist in the cache or if caching is not enabled. |
Remarks
warning
This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return null. Please refer to MessageCacheSize for more details.
This method retrieves the message from the local WebSocket cache and does not send any additional request to Discord. This message may be a message that has been deleted.
GetCachedMessages(IMessage, Direction, Int32)
Gets the last N cached messages starting from a certain message in this message channel.
Declaration
public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = null)
Parameters
Type | Name | Description |
---|---|---|
IMessage | fromMessage | The message to start the fetching from. |
Direction | dir | The direction of which the message should be gotten from. |
Int32 | limit | The number of messages to get. |
Returns
Type | Description |
---|---|
IReadOnlyCollection<SocketMessage> | A read-only collection of WebSocket-based messages. |
Remarks
warning
This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.
This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.
GetCachedMessages(Int32)
Gets the last N cached messages from this message channel.
Declaration
public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | limit | The number of messages to get. |
Returns
Type | Description |
---|---|
IReadOnlyCollection<SocketMessage> | A read-only collection of WebSocket-based messages. |
Remarks
warning
This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.
This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.
GetCachedMessages(UInt64, Direction, Int32)
Gets the last N cached messages starting from a certain message in this message channel.
Declaration
public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = null)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | fromMessageId | The message ID to start the fetching from. |
Direction | dir | The direction of which the message should be gotten from. |
Int32 | limit | The number of messages to get. |
Returns
Type | Description |
---|---|
IReadOnlyCollection<SocketMessage> | A read-only collection of WebSocket-based messages. |
Remarks
warning
This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.
This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.
GetMessageAsync(UInt64, RequestOptions)
Gets a message from this message channel.
Declaration
public async Task<IMessage> GetMessageAsync(ulong id, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | id | The snowflake identifier of the message. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task<IMessage> | 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. |
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<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = null, 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. |
Int32 | limit | The numbers of message to be gotten from. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IReadOnlyCollection<IMessage>> | Paged collection of messages. |
Remarks
This method follows the same behavior as described in
GetMessagesAsync(Int32, RequestOptions)
Gets the last N messages from this message channel.
Declaration
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = null, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | limit | The numbers of message to be gotten from. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IReadOnlyCollection<IMessage>> | Paged collection of messages. |
Remarks
This method follows the same behavior as described in
GetMessagesAsync(UInt64, Direction, Int32, RequestOptions)
Gets a collection of messages in this channel.
Declaration
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = null, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | fromMessageId | The ID of the starting message to get the messages from. |
Direction | dir | The direction of the messages to be gotten from. |
Int32 | limit | The numbers of message to be gotten from. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IReadOnlyCollection<IMessage>> | Paged collection of messages. |
Remarks
This method follows the same behavior as described in
GetPinnedMessagesAsync(RequestOptions)
Gets a read-only 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 |
---|---|
Task<IReadOnlyCollection<RestMessage>> | A task that represents the asynchronous get operation for retrieving pinned messages in this channel. The task result contains a read-only 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)
Gets a user from this group.
Declaration
public SocketGroupUser GetUser(ulong id)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | id | The snowflake identifier of the user. |
Returns
Type | Description |
---|---|
SocketGroupUser | A WebSocket-based group user associated with the snowflake identifier. |
LeaveAsync(RequestOptions)
Declaration
public Task LeaveAsync(RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
RequestOptions | options |
Returns
Type | Description |
---|---|
Task |
ModifyMessageAsync(UInt64, Action<MessageProperties>, RequestOptions)
Declaration
public async Task<IUserMessage> ModifyMessageAsync(ulong messageId, Action<MessageProperties> func, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | messageId | |
Action<MessageProperties> | func | |
RequestOptions | options |
Returns
Type | Description |
---|---|
Task<IUserMessage> |
SendFileAsync(FileAttachment, String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
Declaration
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
Parameters
Type | Name | Description |
---|---|---|
FileAttachment | attachment | |
String | text | |
Boolean | isTTS | |
Embed | embed | |
RequestOptions | options | |
AllowedMentions | allowedMentions | |
MessageReference | messageReference | |
MessageComponent | components | |
ISticker[] | stickers | |
Embed[] | embeds | |
MessageFlags | flags |
Returns
Type | Description |
---|---|
Task<RestUserMessage> |
SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
Declaration
public 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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | |
String | filename | |
String | text | |
Boolean | isTTS | |
Embed | embed | |
RequestOptions | options | |
Boolean | isSpoiler | |
AllowedMentions | allowedMentions | |
MessageReference | messageReference | |
MessageComponent | components | |
ISticker[] | stickers | |
Embed[] | embeds | |
MessageFlags | flags |
Returns
Type | Description |
---|---|
Task<RestUserMessage> |
SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
Declaration
public 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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
Parameters
Type | Name | Description |
---|---|---|
String | filePath | |
String | text | |
Boolean | isTTS | |
Embed | embed | |
RequestOptions | options | |
Boolean | isSpoiler | |
AllowedMentions | allowedMentions | |
MessageReference | messageReference | |
MessageComponent | components | |
ISticker[] | stickers | |
Embed[] | embeds | |
MessageFlags | flags |
Returns
Type | Description |
---|---|
Task<RestUserMessage> |
SendFilesAsync(IEnumerable<FileAttachment>, String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
Declaration
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<FileAttachment> | attachments | |
String | text | |
Boolean | isTTS | |
Embed | embed | |
RequestOptions | options | |
AllowedMentions | allowedMentions | |
MessageReference | messageReference | |
MessageComponent | components | |
ISticker[] | stickers | |
Embed[] | embeds | |
MessageFlags | flags |
Returns
Type | Description |
---|---|
Task<RestUserMessage> |
SendMessageAsync(String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
Declaration
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
Parameters
Type | Name | Description |
---|---|---|
String | text | |
Boolean | isTTS | |
Embed | embed | |
RequestOptions | options | |
AllowedMentions | allowedMentions | |
MessageReference | messageReference | |
MessageComponent | components | |
ISticker[] | stickers | |
Embed[] | embeds | |
MessageFlags | flags |
Returns
Type | Description |
---|---|
Task<RestUserMessage> |
ToString()
Returns the name of the group.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
TriggerTypingAsync(RequestOptions)
Declaration
public Task TriggerTypingAsync(RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
RequestOptions | options |
Returns
Type | Description |
---|---|
Task |
Explicit Interface Implementations
| Improve this Doc View SourceISocketPrivateChannel.Recipients
Declaration
IReadOnlyCollection<SocketUser> ISocketPrivateChannel.Recipients { get; }
Returns
Type | Description |
---|---|
IReadOnlyCollection<SocketUser> |