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
2017-05-21 20:49:34 +02:00

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; }
internal string avatarHash;
public string NameWithTag => $"{Username}#{Tag:0000}";
public override string ToString() => $"<@{Id}>";
public string Avatar(string ext = @"png", 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.Value;
IsBot = user.IsBot;
HasMFA = user.HasMFA;
IsVerified = user.IsVerified;
EMail = user.EMail;
avatarHash = user.AvatarHash;
}
internal void SetPresence(Presence presence)
{
//
}
}
}