Add support for audit log reasons (#708)
* Add support for audit log reasons * Made changes per discussion
This commit is contained in:
committed by
RogueException
parent
9085e44dda
commit
1ce1c019b3
@@ -803,7 +803,8 @@ namespace Discord.API
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
|
||||
var ids = new BucketIds(guildId: guildId);
|
||||
await SendAsync("PUT", () => $"guilds/{guildId}/bans/{userId}?delete-message-days={args.DeleteMessageDays}", ids, options: options).ConfigureAwait(false);
|
||||
string reason = string.IsNullOrWhiteSpace(args.Reason) ? "" : $"&reason={args.Reason}";
|
||||
await SendAsync("PUT", () => $"guilds/{guildId}/bans/{userId}?delete-message-days={args.DeleteMessageDays}{reason}", ids, options: options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task RemoveGuildBanAsync(ulong guildId, ulong userId, RequestOptions options = null)
|
||||
{
|
||||
@@ -980,14 +981,15 @@ namespace Discord.API
|
||||
Expression<Func<string>> endpoint = () => $"guilds/{guildId}/members?limit={limit}&after={afterUserId}";
|
||||
return await SendAsync<IReadOnlyCollection<GuildMember>>("GET", endpoint, ids, options: options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task RemoveGuildMemberAsync(ulong guildId, ulong userId, RequestOptions options = null)
|
||||
public async Task RemoveGuildMemberAsync(ulong guildId, ulong userId, string reason, RequestOptions options = null)
|
||||
{
|
||||
Preconditions.NotEqual(guildId, 0, nameof(guildId));
|
||||
Preconditions.NotEqual(userId, 0, nameof(userId));
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
|
||||
var ids = new BucketIds(guildId: guildId);
|
||||
await SendAsync("DELETE", () => $"guilds/{guildId}/members/{userId}", ids, options: options).ConfigureAwait(false);
|
||||
reason = string.IsNullOrWhiteSpace(reason) ? "" : $"?reason={reason}";
|
||||
await SendAsync("DELETE", () => $"guilds/{guildId}/members/{userId}{reason}", ids, options: options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task ModifyGuildMemberAsync(ulong guildId, ulong userId, Rest.ModifyGuildMemberParams args, RequestOptions options = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user