예제 #1
0
 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);
 }
예제 #2
0
            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();
            }
예제 #3
0
 public LazyDep(LazyUser u)
 {
 }
예제 #4
0
 public MessageBuilder Mention(LazyUser user, bool useNickname)
 {
     _msg.Append(CreateMentionString(user, useNickname));
     return(this);
 }
예제 #5
0
 public static string CreateMentionString(LazyUser user, bool useNickname)
 {
     return(useNickname ? user.MentionContent : user.MentionNoNicknameContent);
 }
예제 #6
0
 public static bool IsMentionableBy(this IMentionable obj, LazyUser user, Server inServer)
 {
     return(obj.IsMentionableByAsync(user, inServer).Await());
 }
예제 #7
0
 public static bool IsMentionableBy(this IMentionable obj, LazyUser user, Server inServer, [CanBeNull] Client client)
 {
     return(obj.IsMentionableByAsync(user, inServer, client).Await());
 }
예제 #8
0
 public static async Task <bool> IsMentionableByAsync(this IMentionable obj, LazyUser user, Server inServer)
 {
     return(await obj.IsMentionableByAsync(user.Id, inServer.Id, null));
 }
예제 #9
0
 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));
 }