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
@@ -107,9 +107,9 @@ namespace Discord.Rest
|
||||
}
|
||||
|
||||
public static async Task AddBanAsync(IGuild guild, BaseDiscordClient client,
|
||||
ulong userId, int pruneDays, RequestOptions options)
|
||||
ulong userId, int pruneDays, string reason, RequestOptions options)
|
||||
{
|
||||
var args = new CreateGuildBanParams { DeleteMessageDays = pruneDays };
|
||||
var args = new CreateGuildBanParams { DeleteMessageDays = pruneDays, Reason = reason };
|
||||
await client.ApiClient.CreateGuildBanAsync(guild.Id, userId, args, options).ConfigureAwait(false);
|
||||
}
|
||||
public static async Task RemoveBanAsync(IGuild guild, BaseDiscordClient client,
|
||||
|
||||
@@ -137,10 +137,10 @@ namespace Discord.Rest
|
||||
public Task<IReadOnlyCollection<RestBan>> GetBansAsync(RequestOptions options = null)
|
||||
=> GuildHelper.GetBansAsync(this, Discord, options);
|
||||
|
||||
public Task AddBanAsync(IUser user, int pruneDays = 0, RequestOptions options = null)
|
||||
=> GuildHelper.AddBanAsync(this, Discord, user.Id, pruneDays, options);
|
||||
public Task AddBanAsync(ulong userId, int pruneDays = 0, RequestOptions options = null)
|
||||
=> GuildHelper.AddBanAsync(this, Discord, userId, pruneDays, options);
|
||||
public Task AddBanAsync(IUser user, int pruneDays = 0, string reason = null, RequestOptions options = null)
|
||||
=> GuildHelper.AddBanAsync(this, Discord, user.Id, pruneDays, reason, options);
|
||||
public Task AddBanAsync(ulong userId, int pruneDays = 0, string reason = null, RequestOptions options = null)
|
||||
=> GuildHelper.AddBanAsync(this, Discord, userId, pruneDays, reason, options);
|
||||
|
||||
public Task RemoveBanAsync(IUser user, RequestOptions options = null)
|
||||
=> GuildHelper.RemoveBanAsync(this, Discord, user.Id, options);
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace Discord.Rest
|
||||
else if (args.RoleIds.IsSpecified)
|
||||
UpdateRoles(args.RoleIds.Value.ToArray());
|
||||
}
|
||||
public Task KickAsync(RequestOptions options = null)
|
||||
=> UserHelper.KickAsync(this, Discord, options);
|
||||
public Task KickAsync(string reason = null, RequestOptions options = null)
|
||||
=> UserHelper.KickAsync(this, Discord, reason, options);
|
||||
/// <inheritdoc />
|
||||
public Task AddRoleAsync(IRole role, RequestOptions options = null)
|
||||
=> AddRolesAsync(new[] { role }, options);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Discord.Rest
|
||||
GuildPermissions IGuildUser.GuildPermissions => GuildPermissions.Webhook;
|
||||
|
||||
ChannelPermissions IGuildUser.GetPermissions(IGuildChannel channel) => Permissions.ToChannelPerms(channel, GuildPermissions.Webhook.RawValue);
|
||||
Task IGuildUser.KickAsync(RequestOptions options)
|
||||
Task IGuildUser.KickAsync(string reason, RequestOptions options)
|
||||
{
|
||||
throw new NotSupportedException("Webhook users cannot be kicked.");
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ namespace Discord.Rest
|
||||
}
|
||||
|
||||
public static async Task KickAsync(IGuildUser user, BaseDiscordClient client,
|
||||
RequestOptions options)
|
||||
string reason, RequestOptions options)
|
||||
{
|
||||
await client.ApiClient.RemoveGuildMemberAsync(user.GuildId, user.Id, options).ConfigureAwait(false);
|
||||
await client.ApiClient.RemoveGuildMemberAsync(user.GuildId, user.Id, reason, options).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public static async Task<RestDMChannel> CreateDMChannelAsync(IUser user, BaseDiscordClient client,
|
||||
|
||||
Reference in New Issue
Block a user