added UserDefaultAvatar to IUser (#973)
* added UserDefaultAvatar to IUser * pass ushort as discriminator * removed unneeded ushort.parse
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Discord.Rest;
|
||||
using Discord.Rest;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Model = Discord.API.User;
|
||||
@@ -37,23 +37,23 @@ namespace Discord.WebSocket
|
||||
{
|
||||
var newVal = ushort.Parse(model.Discriminator.Value);
|
||||
if (newVal != DiscriminatorValue)
|
||||
{
|
||||
{
|
||||
DiscriminatorValue = ushort.Parse(model.Discriminator.Value);
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
if (model.Bot.IsSpecified && model.Bot.Value != IsBot)
|
||||
{
|
||||
{
|
||||
IsBot = model.Bot.Value;
|
||||
hasChanges = true;
|
||||
}
|
||||
if (model.Username.IsSpecified && model.Username.Value != Username)
|
||||
{
|
||||
{
|
||||
Username = model.Username.Value;
|
||||
hasChanges = true;
|
||||
}
|
||||
return hasChanges;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null)
|
||||
=> GlobalUser.DMChannel ?? await UserHelper.CreateDMChannelAsync(this, Discord, options) as IDMChannel;
|
||||
@@ -61,6 +61,9 @@ namespace Discord.WebSocket
|
||||
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
|
||||
=> CDN.GetUserAvatarUrl(Id, AvatarId, size, format);
|
||||
|
||||
public string GetDefaultAvatarUrl()
|
||||
=> CDN.GetDefaultUserAvatarUrl(DiscriminatorValue);
|
||||
|
||||
public override string ToString() => $"{Username}#{Discriminator}";
|
||||
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";
|
||||
internal SocketUser Clone() => MemberwiseClone() as SocketUser;
|
||||
|
||||
Reference in New Issue
Block a user