From 6232236052bafe4823deeb43087ddf9b88a48733 Mon Sep 17 00:00:00 2001 From: Lucid Kobold <72232219+LucidKobold@users.noreply.github.com> Date: Fri, 28 Feb 2025 18:46:18 -0500 Subject: [PATCH] Renamed file --- src/bot/features/blacklistDelete.ts | 49 ----------------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/bot/features/blacklistDelete.ts diff --git a/src/bot/features/blacklistDelete.ts b/src/bot/features/blacklistDelete.ts deleted file mode 100644 index 96f4a79..0000000 --- a/src/bot/features/blacklistDelete.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Composer } from "grammy"; -import type { Context } from "#root/bot/context.js"; -import { logHandle } from "#root/bot/helpers/logging.js"; - -const composer = new Composer(); - -const feature = composer.chatType(["group", "supergroup"]); - -const GROUP_IDS = process.env.GROUP_IDS - ? process.env.GROUP_IDS.split(",") - : undefined; - -feature.hears( - /(x.com|twitter.com)/g, - logHandle("blacklist-detection"), - async (ctx: Context) => { - if (ctx.chat && ctx.msg) { - if (GROUP_IDS !== undefined) { - const groupID = ctx.chat.id; - const flag = GROUP_IDS.includes(`${groupID}`); - const username = ctx.msg.from?.username; - - if (flag) { - ctx.msg.delete(); - await ctx.reply( - ctx.t( - `@${username} Twitter and X links are not allowed here\\. Please consider sharing the media directly or from other social media sources or websites\\. No administration action was taken against you other than the message being deleted\\.` - ), - { parse_mode: "MarkdownV2" } - ); - } - } - - if (!GROUP_IDS) { - await ctx.reply( - ctx.t( - `There was a problem retrieving the whitelist. Check the env variables and try again\\.` - ), - { - parse_mode: "MarkdownV2", - reply_parameters: { message_id: ctx.msg.message_id } - } - ); - } - } - } -); - -export { composer as blacklistDetection };