Added IWebhookUser and MessageSource
This commit is contained in:
@@ -13,21 +13,26 @@ namespace Discord.Rest
|
||||
public ushort DiscriminatorValue { get; private set; }
|
||||
public string AvatarId { get; private set; }
|
||||
|
||||
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
|
||||
=> CDN.GetUserAvatarUrl(Id, AvatarId, size, format);
|
||||
public DateTimeOffset CreatedAt => DateTimeUtils.FromSnowflake(Id);
|
||||
public string Discriminator => DiscriminatorValue.ToString("D4");
|
||||
public string Mention => MentionUtils.MentionUser(Id);
|
||||
public virtual Game? Game => null;
|
||||
public virtual UserStatus Status => UserStatus.Offline;
|
||||
public virtual bool IsWebhook => false;
|
||||
|
||||
internal RestUser(BaseDiscordClient discord, ulong id)
|
||||
: base(discord, id)
|
||||
{
|
||||
}
|
||||
internal static RestUser Create(BaseDiscordClient discord, Model model)
|
||||
=> Create(discord, null, model, null);
|
||||
internal static RestUser Create(BaseDiscordClient discord, IGuild guild, Model model, ulong? webhookId)
|
||||
{
|
||||
var entity = new RestUser(discord, model.Id);
|
||||
RestUser entity;
|
||||
if (webhookId.HasValue)
|
||||
entity = new RestWebhookUser(discord, guild, model.Id, webhookId.Value);
|
||||
else
|
||||
entity = new RestUser(discord, model.Id);
|
||||
entity.Update(model);
|
||||
return entity;
|
||||
}
|
||||
@@ -52,6 +57,9 @@ namespace Discord.Rest
|
||||
public Task<RestDMChannel> CreateDMChannelAsync(RequestOptions options = null)
|
||||
=> UserHelper.CreateDMChannelAsync(this, Discord, options);
|
||||
|
||||
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
|
||||
=> CDN.GetUserAvatarUrl(Id, AvatarId, size, format);
|
||||
|
||||
public override string ToString() => $"{Username}#{Discriminator}";
|
||||
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user