Esempio n. 1
0
 private ServerEmoji(ulong forServer, EmojiJson json, ulong ogId) : base(json.id, json.name)
 {
     if (json.id == 0)
     {
         throw new NoSuchEmojiException("No emoji with ID " + ogId + " exists on server " + forServer + ".");
     }
     ServerId = forServer;
     Server   = new CachedPromise <Servers.Server>(Servers.Server._cache, ServerId, Servers.Server.GetAsync);
 }
Esempio n. 2
0
 internal ServerData(ulong forUser, ulong inServer, ServerUserJson json)
 {
     RelatedUserId   = forUser;
     RelatedUser     = new CachedPromise <User>(User._cache, forUser, User.GetAsync);
     LazyRelatedUser = LazyUser.Get(forUser);
     ServerId        = inServer;
     Server          = new CachedPromise <Servers.Server>(Servers.Server._cache, inServer, Servers.Server.GetAsync);
     Nickname        = json.nick;
     Roles           = json.roles.Select(id => new CachedPromise <Role>(Role._cache, id, async(id2, client) => await Role.GetAsync(id2, inServer, client))).ToDictionary(cp => cp.ValueId);
     UserJoinTime    = DateTime.Parse(json.joined_at);
     IsDeafened      = json.deaf;
     IsMuted         = json.mute;
 }