internal override void Populate(ChannelJson json, [CanBeNull] object state) { Members = json.recipients.Select(x => User.CreateFromJson(x, state)).ToIdDic(); OwnerId = state != null ? (ulong)state : (ulong)json.owner_id; Owner = new CachedPromise <User>(User._cache, OwnerId, User.GetAsync); LazyOwner = LazyUser.Get(OwnerId); }
public ServerUserSet(JObject data) { JsonObjectReader r = data.GetReader(); ServerId = r.ReadSnowflake("guild_id"); Users = r.ReadObjectArray <ServerUserJson>("members").Select(x => { User res = User.CreateFromJson(x.user, ServerId); LazyUser.PushServerData(ServerId, x); return(res); }).ToArray(); }
public LazyDep(LazyUser u) { }
public MessageBuilder Mention(LazyUser user, bool useNickname) { _msg.Append(CreateMentionString(user, useNickname)); return(this); }
public static string CreateMentionString(LazyUser user, bool useNickname) { return(useNickname ? user.MentionContent : user.MentionNoNicknameContent); }
public static bool IsMentionableBy(this IMentionable obj, LazyUser user, Server inServer) { return(obj.IsMentionableByAsync(user, inServer).Await()); }
public static bool IsMentionableBy(this IMentionable obj, LazyUser user, Server inServer, [CanBeNull] Client client) { return(obj.IsMentionableByAsync(user, inServer, client).Await()); }
public static async Task <bool> IsMentionableByAsync(this IMentionable obj, LazyUser user, Server inServer) { return(await obj.IsMentionableByAsync(user.Id, inServer.Id, null)); }
public static async Task <bool> IsMentionableByAsync(this IMentionable obj, LazyUser user, Server inServer, [CanBeNull] Client client) { return(await obj.IsMentionableByAsync(user.Id, inServer.Id, client)); }