/// <inheritdoc/> public async Task <DiscordGuildMemberPacket> GetGuildUserAsync( ulong userId, ulong guildId) { var response = await httpClient.GetAsync( DiscordApiRoutes.GuildMember(guildId, userId)) .ConfigureAwait(false); HandleErrors(response, options); return(JsonSerializer.Deserialize <DiscordGuildMemberPacket>(response.Body, options)); }
/// <inheritdoc/> public async Task ModifyGuildMemberAsync( ulong guildId, ulong userId, ModifyGuildMemberArgs packet) { var response = await httpClient.PatchAsync( DiscordApiRoutes.GuildMember(guildId, userId), JsonSerializer.Serialize(packet, options)) .ConfigureAwait(false); HandleErrors(response, options); }
/// <inheritdoc/> public async Task RemoveGuildMemberAsync( ulong guildId, ulong userId, string reason = null) { QueryString qs = new QueryString(); if (!string.IsNullOrWhiteSpace(reason)) { qs.Add("reason", reason); } var response = await httpClient.DeleteAsync( DiscordApiRoutes.GuildMember(guildId, userId) + qs.Query) .ConfigureAwait(false); HandleErrors(response, options); }