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

50 lines
1.5 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; }
2017-05-17 22:33:09 +00:00
public DiscordUserStatus Status { get; internal set; }
public DiscordGame Game { get; internal set; }
2017-05-14 12:02:51 +00:00
2017-05-21 18:49:34 +00:00
internal string avatarHash;
2017-05-14 12:02:51 +00:00
public string NameWithTag => $"{Username}#{Tag:0000}";
2017-05-17 22:33:09 +00:00
public override string ToString() => $"<@{Id}>";
2017-05-14 12:02:51 +00:00
2017-05-21 01:50:37 +00:00
public string Avatar(string ext = @"png", int size = 128) => RestEndpoints.CDN_URL + $@"/avatars/{Id}/{avatarHash}.{ext}?size={size}";
2017-05-14 12:02:51 +00:00
internal DiscordUser(Discord discord, User user)
{
client = discord;
Id = user.Id;
Created = Utility.FromDiscordTimeMilliseconds((long) Id >> 22);
Username = user.Username;
2017-05-21 18:49:34 +00:00
Tag = user.Tag.Value;
2017-05-14 12:02:51 +00:00
IsBot = user.IsBot;
HasMFA = user.HasMFA;
IsVerified = user.IsVerified;
EMail = user.EMail;
avatarHash = user.AvatarHash;
}
internal void SetPresence(Presence presence)
{
//
}
}
}