From 33d7a15d8c2a26adcf29ec6026034310d2cc9efc Mon Sep 17 00:00:00 2001 From: GhomKrosmonaute Date: Sun, 27 Oct 2024 18:38:37 +0100 Subject: [PATCH] fixed cached last active members value --- src/listeners/activity.ready.ts | 8 +++++--- src/namespaces/automod.ts | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/listeners/activity.ready.ts b/src/listeners/activity.ready.ts index 52bf3049..66cb3f12 100644 --- a/src/listeners/activity.ready.ts +++ b/src/listeners/activity.ready.ts @@ -2,8 +2,6 @@ import * as app from "#app" const intervals: Record = {} -let lastActiveCount = 0 - const listener: app.Listener<"ready"> = { event: "ready", description: "Start an interval to update the active list", @@ -48,6 +46,10 @@ const listener: app.Listener<"ready"> = { return } + const cacheId = `lastActiveCount.${guild.id}` + + const lastActiveCount = app.cache.ensure(cacheId, 0) + if (found > lastActiveCount) { await app.sendLog( realGuild, @@ -64,7 +66,7 @@ const listener: app.Listener<"ready"> = { ) } - lastActiveCount = found + app.cache.set(cacheId, found) }, interval * 1000 * 60 * 60, ) diff --git a/src/namespaces/automod.ts b/src/namespaces/automod.ts index 00a417cd..7051ed6c 100644 --- a/src/namespaces/automod.ts +++ b/src/namespaces/automod.ts @@ -63,7 +63,10 @@ export async function detectAndBanSpammer(message: app.Message) { await general.send( `${app.emote(message, "CheckMark")} **${ message.author.tag - }** detected as a spammer and banned from **${success}** labs.\n> **${errored}** labs failed to ban the user.`, + }** detected as a spammer and banned from **${success}** labs.\n**${errored}** labs failed to ban the user Reasons:\n${result + .filter((result) => result.status === "rejected") + .map((result) => `- ${result.reason}`) + .join("\n")}`, ) } else { await general.send(