Audit Logs implementation (#1055)
* Copy audit logs impl from old branch and clean up I suck at using git, so I'm gonna use brute force. * Remove unnecessary TODOs Category channels do not provide any new information, and the other I forgot to remove beforehand * Add invite update data, clean up after feedback * Remove TODOs, add WebhookType enum for future use WebhookType is a future-use type, as currently audit logs are the only thing which may return it.
This commit is contained in:
committed by
Christopher F
parent
97c893107b
commit
39dffe8585
@@ -438,6 +438,10 @@ namespace Discord.WebSocket
|
||||
_downloaderPromise.TrySetResultAsync(true);
|
||||
}
|
||||
|
||||
//Audit logs
|
||||
public IAsyncEnumerable<IReadOnlyCollection<RestAuditLogEntry>> GetAuditLogsAsync(int limit, RequestOptions options = null)
|
||||
=> GuildHelper.GetAuditLogsAsync(this, Discord, null, limit, options);
|
||||
|
||||
//Webhooks
|
||||
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
|
||||
=> GuildHelper.GetWebhookAsync(this, Discord, id, options);
|
||||
@@ -703,6 +707,14 @@ namespace Discord.WebSocket
|
||||
Task<IGuildUser> IGuild.GetOwnerAsync(CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IGuildUser>(Owner);
|
||||
|
||||
async Task<IReadOnlyCollection<IAuditLogEntry>> IGuild.GetAuditLogAsync(int limit, CacheMode cacheMode, RequestOptions options)
|
||||
{
|
||||
if (cacheMode == CacheMode.AllowDownload)
|
||||
return (await GetAuditLogsAsync(limit, options).FlattenAsync().ConfigureAwait(false)).ToImmutableArray();
|
||||
else
|
||||
return ImmutableArray.Create<IAuditLogEntry>();
|
||||
}
|
||||
|
||||
async Task<IWebhook> IGuild.GetWebhookAsync(ulong id, RequestOptions options)
|
||||
=> await GetWebhookAsync(id, options);
|
||||
async Task<IReadOnlyCollection<IWebhook>> IGuild.GetWebhooksAsync(RequestOptions options)
|
||||
|
||||
Reference in New Issue
Block a user