Skip to content

Commit

Permalink
lets see if this works
Browse files Browse the repository at this point in the history
  • Loading branch information
SylveonDeko committed Oct 11, 2024
1 parent 1cea622 commit 94b0ca7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Mewdeko/Modules/Administration/Services/LogCommandService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,14 +1058,23 @@ private async Task OnMessageDeleted(Cacheable<IMessage, ulong> args, Cacheable<I

var entry = auditLogs.FirstOrDefault();

if (entry.Data is not MessageDeleteAuditLogData data)
return;

var currentTime = DateTimeOffset.UtcNow;
var timeThreshold = TimeSpan.FromSeconds(2);

var deleteUser = data.ChannelId == message.Channel.Id &&
(currentTime - entry.CreatedAt) <= timeThreshold ? entry.User : message.Author;

var eb = new EmbedBuilder()
.WithOkColor()
.WithTitle("Message Deleted")
.WithDescription(
$"`Message Author:` {message.Author.Mention}\n" +
$"`Message Channel:` {guildChannel.Mention} | {guildChannel.Id}\n" +
$"`Message Content:` {message.Content}\n" +
$"`Deleted By:` {(entry is null ? message.Author.Mention : entry.User.Mention)} | {(entry is null ? message.Author.Id : entry.User.Id)}");
$"`Deleted By:` {deleteUser.Mention} | {deleteUser.Id}");

// Handle attachments
if (message.Attachments.Count != 0)
Expand Down

0 comments on commit 94b0ca7

Please sign in to comment.