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; }
public static bool ContainsUser(this IReadOnlyDictionary <ulong, User> dic, LazyUser value) { return(dic.ContainsKey(value.Id)); }