49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using Maki.Rest;
|
|
using Maki.Structures.Presences;
|
|
using Maki.Structures.Users;
|
|
using System;
|
|
|
|
namespace Maki
|
|
{
|
|
public class DiscordUser
|
|
{
|
|
public readonly ulong Id;
|
|
public readonly bool IsBot;
|
|
public readonly DateTime Created;
|
|
private readonly Discord client;
|
|
|
|
public string Username { get; internal set; }
|
|
public ushort Tag { get; internal set; }
|
|
public bool HasMFA { get; internal set; }
|
|
public bool IsVerified { get; internal set; }
|
|
public string EMail { get; internal set; }
|
|
public DiscordUserStatus Status { get; internal set; }
|
|
public DiscordGame Game { get; internal set; }
|
|
|
|
public string NameWithTag => $"{Username}#{Tag:0000}";
|
|
public override string ToString() => $"<@{Id}>";
|
|
|
|
private string avatarHash;
|
|
|
|
public string Avatar(string ext = @"jpg", int size = 128) => RestEndpoints.CDN_URL + $@"/avatars/{Id}/{avatarHash}.{ext}?size={size}";
|
|
|
|
internal DiscordUser(Discord discord, User user)
|
|
{
|
|
client = discord;
|
|
Id = user.Id;
|
|
Created = Utility.FromDiscordTimeMilliseconds((long) Id >> 22);
|
|
Username = user.Username;
|
|
Tag = user.Tag;
|
|
IsBot = user.IsBot;
|
|
HasMFA = user.HasMFA;
|
|
IsVerified = user.IsVerified;
|
|
EMail = user.EMail;
|
|
avatarHash = user.AvatarHash;
|
|
}
|
|
|
|
internal void SetPresence(Presence presence)
|
|
{
|
|
//
|
|
}
|
|
}
|
|
}
|