Ejemplo n.º 1
0
 private bool GetAuditLogEntry(IGuild guild, out IAuditLogEntry auditLog, Discord.ActionType type)
 {
     auditLog = guild.GetAuditLogsAsync(5).GetAwaiter().GetResult().FirstOrDefault(x => x.Action == type);
     if (auditLog == null)
     {
         return(false);
     }
     //var timeStamp = SnowflakeUtils.FromSnowflake(auditLog.Id);
     //if (timeStamp > DateTimeOffset.Now - TimeSpan.FromSeconds(5)) return false;
     return(auditLog.User.Id != _client.CurrentUser.Id);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Converts an existing <see cref="IAuditLogEntry"/> to an abstracted <see cref="IAuditLogEntry"/> value.
 /// </summary>
 /// <param name="auditLogEntry">The existing <see cref="IAuditLogEntry"/> to be abstracted.</param>
 /// <exception cref="ArgumentNullException">Throws for <paramref name="auditLogEntry"/>.</exception>
 /// <returns>An <see cref="IAuditLogEntry"/> that abstracts <paramref name="auditLogEntry"/>.</returns>
 public static IAuditLogEntry Abstract(this IAuditLogEntry auditLogEntry)
 => auditLogEntry switch
 {
     null
     => throw new ArgumentNullException(nameof(auditLogEntry)),