コード例 #1
0
        //Users
        /// <exception cref="InvalidOperationException">Resolving permissions requires the parent guild to be downloaded.</exception>
        public static async Task <RestGuildUser> GetUserAsync(IGuildChannel channel, IGuild guild, BaseDiscordClient client,
                                                              ulong id, RequestOptions options)
        {
            API.GuildMemberJson model = await client.ApiClient.GetGuildMemberAsync(channel.GuildId, id, options).ConfigureAwait(false);

            if (model == null)
            {
                return(null);
            }
            RestGuildUser user = RestGuildUser.Create(client, guild, model);

            if (!user.GetPermissions(channel).ViewChannel)
            {
                return(null);
            }

            return(user);
        }
コード例 #2
0
 /// <inheritdoc />
 public ChannelPermissions GetPermissions(IGuildChannel channel)
 => RestGuildUser.GetPermissions(channel);