Archived
1
0
Fork 0
This repository has been archived on 2024-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
maki/Maki/DiscordUser.cs

49 lines
1.4 KiB
C#
Raw Normal View History

2017-05-14 12:02:51 +00:00
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 string NameWithTag => $"{Username}#{Tag:0000}";
public string At => $"<@{Id}>";
public override string ToString() => At;
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)
{
//
}
}
}