Skip to main content

Class SocketChannel

Represents a WebSocket-based channel.

Assembly: Discord.Net.WebSocket.dll​
View Source​
Declaration
public abstract class SocketChannel : SocketEntity<ulong>, IChannel, ISnowflakeEntity, IEntity<ulong>

Properties​

CreatedAt​

Gets when the channel is created.

View Source​
Declaration
public DateTimeOffset CreatedAt { get; }

Users​

Gets a collection of users from the WebSocket cache.

View Source​
Declaration
public IReadOnlyCollection<SocketUser> Users { get; }

IChannel.Name​

Gets the name of this channel.

View Source​
Declaration
string IChannel.Name { get; }

Methods​

GetUser(UInt64)​

Gets a generic user from this channel.

View Source​
Declaration
public SocketUser GetUser(ulong id)
Returns​

Discord.WebSocket.SocketUser: A generic WebSocket-based user associated with the snowflake identifier.

Parameters​
TypeNameDescription
System.UInt64idThe snowflake identifier of the user.

IChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)​

Gets a user in this channel.

View Source​
Declaration
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Returns​

System.Threading.Tasks.Task<Discord.IUser>: A task that represents the asynchronous get operation. The task result contains a user object that represents the found user; null if none is found.

Parameters​
TypeNameDescription
System.UInt64idThe snowflake identifier of the user (e.g. 168693960628371456).
Discord.CacheModemodeThe Discord.CacheMode that determines whether the object should be fetched from cache.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

IChannel.GetUsersAsync(CacheMode, RequestOptions)​

Gets a collection of users that are able to view the channel or are currently in this channel.

View Source​
Declaration
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
Returns​

System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<Discord.IUser>>: Paged collection of users.

Parameters​
TypeNameDescription
Discord.CacheModemodeThe Discord.CacheMode that determines whether the object should be fetched from cache.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

Implements​