Class RestUser
Represents a REST-based user.
Assembly: Discord.Net.Rest.dll​
View Source​
public class RestUser : RestEntity<ulong>, IUser, ISnowflakeEntity, IEntity<ulong>, IMentionable, IPresence, IUpdateable
Properties​
IsBot​
Gets a value that indicates whether this user is identified as a bot.
View Source​
public bool IsBot { get; }
Username​
Gets the username for this user.
View Source​
public string Username { get; }
DiscriminatorValue​
Gets the per-username unique ID for this user.
View Source​
public ushort DiscriminatorValue { get; }
AvatarId​
Gets the identifier of this user's avatar.
View Source​
public string AvatarId { get; }
BannerId​
View Source​
public string BannerId { get; }
AccentColor​
View Source​
public Color? AccentColor { get; }
PublicFlags​
Gets the public flags that are applied to this user's account.
View Source​
public UserProperties? PublicFlags { get; }
CreatedAt​
Gets when the snowflake was created.
View Source​
public DateTimeOffset CreatedAt { get; }
Discriminator​
Gets the per-username unique ID for this user.
View Source​
public string Discriminator { get; }
Mention​
Returns a special string used to mention this object.
View Source​
public string Mention { get; }
Activity​
View Source​
public virtual IActivity Activity { get; }
Status​
Gets the current status of this user.
View Source​
public virtual UserStatus Status { get; }
ActiveClients​
Gets the set of clients where this user is currently active.
View Source​
public virtual IReadOnlyCollection<ClientType> ActiveClients { get; }
Activities​
Gets the list of activities that this user currently has available.
View Source​
public virtual IReadOnlyCollection<IActivity> Activities { get; }
IsWebhook​
Gets a value that indicates whether this user is a webhook user.
View Source​
public virtual bool IsWebhook { get; }
Methods​
UpdateAsync(RequestOptions)​
Updates this object's properties with its current state.
View Source​
public virtual async Task UpdateAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
CreateDMChannelAsync(RequestOptions)​
Creates a direct message channel to this user.
View Source​
public Task<RestDMChannel> CreateDMChannelAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<Discord.Rest.RestDMChannel>
:
A task that represents the asynchronous get operation. The task result contains a rest DM channel where the user is the recipient.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
GetAvatarUrl(ImageFormat, UInt16)​
Gets the avatar URL for this user.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.ImageFormat | format | The format to return. |
System.UInt16 | size | The size of the image to return in. This can be any power of two between 16 and 2048. |
GetBannerUrl(ImageFormat, UInt16)​
View Source​
public string GetBannerUrl(ImageFormat format = ImageFormat.Auto, ushort size = 256)
Returns​
System.String
Parameters​
Type | Name |
---|---|
Discord.ImageFormat | format |
System.UInt16 | size |
GetDefaultAvatarUrl()​
Gets the default avatar URL for this user.
View Source​
public string GetDefaultAvatarUrl()
Returns​
System.String
:
A string representing the user's avatar URL.
ToString()​
Gets the Username#Discriminator of the user.
View Source​
public override string ToString()
Returns​
System.String
:
A string that resolves to Username#Discriminator of the user.
IUser.CreateDMChannelAsync(RequestOptions)​
Creates the direct message channel of this user.
View Source​
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options)
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​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |