//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); }
public static async Task <RestGuildUser> GetGuildUserAsync(BaseDiscordClient client, ulong guildId, ulong id, RequestOptions options) { RestGuild guild = await GetGuildAsync(client, guildId, false, options).ConfigureAwait(false); if (guild == null) { return(null); } API.GuildMemberJson model = await client.ApiClient.GetGuildMemberAsync(guildId, id, options).ConfigureAwait(false); if (model != null) { return(RestGuildUser.Create(client, guild, model)); } return(null); }