Skip to main content

Class SocketUser

Represents a WebSocket-based user.

Assembly: Discord.Net.WebSocket.dll​
View Source​
Declaration
public abstract class SocketUser : SocketEntity<ulong>, IUser, ISnowflakeEntity, IEntity<ulong>, IMentionable, IPresence

Properties​

IsBot​

Gets a value that indicates whether this user is identified as a bot.

View Source​
Declaration
public abstract bool IsBot { get; }

Username​

Gets the username for this user.

View Source​
Declaration
public abstract string Username { get; }

DiscriminatorValue​

Gets the per-username unique ID for this user.

View Source​
Declaration
public abstract ushort DiscriminatorValue { get; }

AvatarId​

Gets the identifier of this user's avatar.

View Source​
Declaration
public abstract string AvatarId { get; }

IsWebhook​

Gets a value that indicates whether this user is a webhook user.

View Source​
Declaration
public abstract bool IsWebhook { get; }

PublicFlags​

Gets the public flags that are applied to this user's account.

View Source​
Declaration
public UserProperties? PublicFlags { get; }

CreatedAt​

Gets when the snowflake was created.

View Source​
Declaration
public DateTimeOffset CreatedAt { get; }

Discriminator​

Gets the per-username unique ID for this user.

View Source​
Declaration
public string Discriminator { get; }

Mention​

Returns a special string used to mention this object.

View Source​
Declaration
public string Mention { get; }

Status​

Gets the current status of this user.

View Source​
Declaration
public UserStatus Status { get; }

ActiveClients​

Gets the set of clients where this user is currently active.

View Source​
Declaration
public IReadOnlyCollection<ClientType> ActiveClients { get; }

Activities​

Gets the list of activities that this user currently has available.

View Source​
Declaration
public IReadOnlyCollection<IActivity> Activities { get; }

MutualGuilds​

Gets mutual guilds shared with this user.

View Source​
Declaration
public IReadOnlyCollection<SocketGuild> MutualGuilds { get; }

Methods​

CreateDMChannelAsync(RequestOptions)​

Creates the direct message channel of this user.

View Source​
Declaration
public async Task<IDMChannel> CreateDMChannelAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.IDMChannel>: A task that represents the asynchronous operation for getting or creating a DM channel. The task result contains the DM channel associated with this user.

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

GetAvatarUrl(ImageFormat, UInt16)​

Gets the avatar URL for this user.

View Source​
Declaration
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
Returns​

System.String: A string representing the user's avatar URL; null if the user does not have an avatar in place.

Parameters​
TypeNameDescription
Discord.ImageFormatformatThe format to return.
System.UInt16sizeThe size of the image to return in. This can be any power of two between 16 and 2048.

GetDefaultAvatarUrl()​

Gets the default avatar URL for this user.

View Source​
Declaration
public string GetDefaultAvatarUrl()
Returns​

System.String: A string representing the user's avatar URL.

ToString()​

Gets the full name of the user (e.g. Example#0001).

View Source​
Declaration
public override string ToString()
Returns​

System.String: The full name of the user.

Implements​