mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
fix: handle case when audit log entries for message delete are empty
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
2b0c4b62d3
commit
1276451dc5
1 changed files with 3 additions and 3 deletions
|
@ -66,10 +66,10 @@ public sealed class MessageDeletedResponder : IResponder<IMessageDelete>
|
||||||
return ResultExtensions.FromError(auditLogResult);
|
return ResultExtensions.FromError(auditLogResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
var auditLog = auditLogPage.AuditLogEntries.Single();
|
|
||||||
|
|
||||||
var deleterResult = Result<IUser>.FromSuccess(message.Author);
|
var deleterResult = Result<IUser>.FromSuccess(message.Author);
|
||||||
if (auditLog.UserID is not null
|
|
||||||
|
var auditLog = auditLogPage.AuditLogEntries.SingleOrDefault();
|
||||||
|
if (auditLog is { UserID: not null }
|
||||||
&& auditLog.Options.Value.ChannelID == gatewayEvent.ChannelID
|
&& auditLog.Options.Value.ChannelID == gatewayEvent.ChannelID
|
||||||
&& DateTimeOffset.UtcNow.Subtract(auditLog.ID.Timestamp).TotalSeconds <= 2)
|
&& DateTimeOffset.UtcNow.Subtract(auditLog.ID.Timestamp).TotalSeconds <= 2)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue