From fcf39a6ffb05e92add0b2a721348d95be094cacb Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Sun, 19 Oct 2025 22:13:51 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A7=B9=20chore:=20add=20logging=20for?= =?UTF-8?q?=20target=20ID=20and=20message=20author=20ID=20in=20handleDelet?= =?UTF-8?q?eMessages=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/moderation/repel.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/commands/moderation/repel.ts b/src/commands/moderation/repel.ts index f467007..d67cc22 100644 --- a/src/commands/moderation/repel.ts +++ b/src/commands/moderation/repel.ts @@ -144,18 +144,23 @@ const handleDeleteMessages = async ({ lookBack: number; }) => { let deleted = 0; + console.log({ '😭 targetId': target.id }); const failedChannels: string[] = []; await Promise.allSettled( channels.map(async (channel) => { try { const messages = channel.messages.cache; const targetMessages = messages - .filter( - (message) => + .filter((message) => { + console.log({ + '😭 message author id': message.author.id, + }); + return ( message.author.id === target.id && message.deletable && Date.now() - message.createdTimestamp < lookBack - ) + ); + }) .first(10); if (targetMessages.length === 0) { From f030ea21d5bb93c09242b139b138b97a9385ff56 Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Sun, 19 Oct 2025 22:24:47 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20fix:=20check=20for=20author?= =?UTF-8?q?=20before=20trying=20to=20access=20author.id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/moderation/repel.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/commands/moderation/repel.ts b/src/commands/moderation/repel.ts index d67cc22..15685bb 100644 --- a/src/commands/moderation/repel.ts +++ b/src/commands/moderation/repel.ts @@ -144,7 +144,6 @@ const handleDeleteMessages = async ({ lookBack: number; }) => { let deleted = 0; - console.log({ '😭 targetId': target.id }); const failedChannels: string[] = []; await Promise.allSettled( channels.map(async (channel) => { @@ -152,10 +151,8 @@ const handleDeleteMessages = async ({ const messages = channel.messages.cache; const targetMessages = messages .filter((message) => { - console.log({ - '😭 message author id': message.author.id, - }); return ( + message.author && message.author.id === target.id && message.deletable && Date.now() - message.createdTimestamp < lookBack