Add support for audit log reasons (#708)

* Add support for audit log reasons

* Made changes per discussion
This commit is contained in:
Christopher F
2017-06-29 16:01:59 -04:00
committed by RogueException
parent 9085e44dda
commit 1ce1c019b3
19 changed files with 53 additions and 41 deletions

View File

@@ -66,10 +66,10 @@ namespace Discord
Task<IReadOnlyCollection<IBan>> GetBansAsync(RequestOptions options = null);
/// <summary> Bans the provided user from this guild and optionally prunes their recent messages. </summary>
/// <param name="pruneDays">The number of days to remove messages from this user for - must be between [0, 7]</param>
Task AddBanAsync(IUser user, int pruneDays = 0, RequestOptions options = null);
Task AddBanAsync(IUser user, int pruneDays = 0, string reason = null, RequestOptions options = null);
/// <summary> Bans the provided user id from this guild and optionally prunes their recent messages. </summary>
/// <param name="pruneDays">The number of days to remove messages from this user for - must be between [0, 7]</param>
Task AddBanAsync(ulong userId, int pruneDays = 0, RequestOptions options = null);
Task AddBanAsync(ulong userId, int pruneDays = 0, string reason = null, RequestOptions options = null);
/// <summary> Unbans the provided user if it is currently banned. </summary>
Task RemoveBanAsync(IUser user, RequestOptions options = null);
/// <summary> Unbans the provided user id if it is currently banned. </summary>

View File

@@ -25,7 +25,7 @@ namespace Discord
ChannelPermissions GetPermissions(IGuildChannel channel);
/// <summary> Kicks this user from this guild. </summary>
Task KickAsync(RequestOptions options = null);
Task KickAsync(string reason = null, RequestOptions options = null);
/// <summary> Modifies this user's properties in this guild. </summary>
Task ModifyAsync(Action<GuildUserProperties> func, RequestOptions options = null);

View File

@@ -9,8 +9,8 @@ namespace Discord.Net.Rest
void SetHeader(string key, string value);
void SetCancelToken(CancellationToken cancelToken);
Task<RestResponse> SendAsync(string method, string endpoint, CancellationToken cancelToken, bool headerOnly = false);
Task<RestResponse> SendAsync(string method, string endpoint, string json, CancellationToken cancelToken, bool headerOnly = false);
Task<RestResponse> SendAsync(string method, string endpoint, IReadOnlyDictionary<string, object> multipartParams, CancellationToken cancelToken, bool headerOnly = false);
Task<RestResponse> SendAsync(string method, string endpoint, CancellationToken cancelToken, bool headerOnly = false, string reason = null);
Task<RestResponse> SendAsync(string method, string endpoint, string json, CancellationToken cancelToken, bool headerOnly = false, string reason = null);
Task<RestResponse> SendAsync(string method, string endpoint, IReadOnlyDictionary<string, object> multipartParams, CancellationToken cancelToken, bool headerOnly = false, string reason = null);
}
}

View File

@@ -14,6 +14,10 @@ namespace Discord
public CancellationToken CancelToken { get; set; } = CancellationToken.None;
public RetryMode? RetryMode { get; set; }
public bool HeaderOnly { get; internal set; }
/// <summary>
/// The reason for this action in the guild's audit log
/// </summary>
public string AuditLogReason { get; set; }
internal bool IgnoreState { get; set; }
internal string BucketId { get; set; }