From d81656852279909674607d590eec07dcb9f8a6e6 Mon Sep 17 00:00:00 2001 From: Lucid Date: Mon, 26 Jan 2026 19:34:25 -0500 Subject: [PATCH] Moved env variables into function. --- src/bot/features/botInfoCommand.ts | 10 +++++----- src/bot/features/embedCheck.ts | 4 ++-- src/bot/features/getGroupStatsCommand.ts | 4 ++-- src/bot/features/metaBlacklist.ts | 4 ++-- src/bot/features/twitterBlacklist.ts | 4 ++-- src/bot/features/welcome.ts | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/bot/features/botInfoCommand.ts b/src/bot/features/botInfoCommand.ts index bb5158d..9796318 100644 --- a/src/bot/features/botInfoCommand.ts +++ b/src/bot/features/botInfoCommand.ts @@ -8,8 +8,6 @@ const composer = new Composer(); const feature = composer.chatType(["private", "group", "supergroup"]); -const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; - /** * What triggers this feature and adds to the log when it has been triggered. * The trigger is the command "/botInfo" @@ -18,6 +16,8 @@ feature.hears( /^\/botInfo/, logHandle("bot-info-command"), async (ctx: Context) => { + const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; + await urql.mutation(increment, { trigger: true, mutationKey }); // Checks if the context includes a message property. @@ -45,21 +45,21 @@ feature.hears( } ); await ctx.reply( - `[Lucid](https://werewolfkid.monster) made this bot as a protest against the enshittification of Twitter and Nazi\\-fication of it\\ ever since Elon Must did a Nazi salute at a Trump Rally celebrating Trump\\'s second inauguration\\.`, + `[Lucid](https://werewolfkid.monster) made this bot as a protest against the enshittification and Nazi\\-fication of Twitter\\ ever since Elon Musk took it over. The final straw aws when he did a Nazi salute at a Trump Rally celebrating Trump\\'s second inauguration\\.`, { parse_mode: "MarkdownV2", reply_parameters: { message_id: ctx.msg.message_id } } ); await ctx.reply( - `Recently there have been reports of extremist right\\-wing individuals doxxing and harassing anyone left of center\\. The victims have come out to state that they\\'ve had several accounts hacked into\\, including onces with unique passwords\\. It is clear that these assholes are using some kind of script kiddie malware to capture\\/steal credentials and possibly even stored passwords\\.`, + `There have been reports of extremist right\\-wing individuals doxxing and harassing anyone left of center\\. The victims have come out to state that they\\'ve had several accounts hacked into\\, including onces with unique passwords\\. It is clear that these assholes are using some kind of script kiddie malware to capture\\/steal credentials and possibly even stored passwords\\.`, { parse_mode: "MarkdownV2", reply_parameters: { message_id: ctx.msg.message_id } } ); return await ctx.reply( - `Lucid decided it was time to make a statement\\. Twitter\\/X is not safe anymore\\. The fandom doesn\\'t need it\\. It should be boycotted and not allowed anymore\\. Thus decided to try making this bot public\\-use to test it's viability\\. Feel free to add this bot into your own group\\. All it needs is an admin role with the permission to delete messages\\.`, + `Lucid decided it was time to make a statement\\. Twitter\\/X is not safe anymore\\. The fandom doesn\\'t need it\\. It should be boycotted and not allowed anymore\\. Thus he decided to try making this bot public\\-use to test it's viability\\. Feel free to add this bot into your own group\\. All it needs is an admin role with the permission to delete messages\\.`, { parse_mode: "MarkdownV2", reply_parameters: { message_id: ctx.msg.message_id } diff --git a/src/bot/features/embedCheck.ts b/src/bot/features/embedCheck.ts index 0c40813..8103b0f 100644 --- a/src/bot/features/embedCheck.ts +++ b/src/bot/features/embedCheck.ts @@ -12,13 +12,13 @@ const composer = new Composer(); const feature = composer.chatType(["group", "supergroup"]); -const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; - /** * What triggers this feature and adds to the log when it has been triggered. * The trigger is anytime an embedded url is detected. */ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => { + const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; + await urql.mutation(increment, { trigger: true, mutationKey }); if (ctx.chat && ctx.msg) { diff --git a/src/bot/features/getGroupStatsCommand.ts b/src/bot/features/getGroupStatsCommand.ts index fd8cd97..f9cba53 100644 --- a/src/bot/features/getGroupStatsCommand.ts +++ b/src/bot/features/getGroupStatsCommand.ts @@ -9,8 +9,6 @@ const composer = new Composer(); const feature = composer.chatType(["group", "supergroup"]); -const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; - /** * What triggers this feature and adds to the log when it has been triggered. * The trigger is the command "/groupStats" @@ -19,6 +17,8 @@ feature.hears( /^\/groupStats/, logHandle("groups-stats-command"), async (ctx: Context) => { + const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; + await urql.mutation(increment, { trigger: true, mutationKey }); // Checks if the context includes a message property. diff --git a/src/bot/features/metaBlacklist.ts b/src/bot/features/metaBlacklist.ts index 8927f82..7cb745b 100644 --- a/src/bot/features/metaBlacklist.ts +++ b/src/bot/features/metaBlacklist.ts @@ -11,8 +11,6 @@ const composer = new Composer(); const feature = composer.chatType(["group", "supergroup"]); -const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; - /** * What triggers this feature and adds to the log when it has been triggered. * The trigger uses the global Twitter regex to detect Twitter and X links within messages. @@ -21,6 +19,8 @@ feature.hears( metaRegex, logHandle("blacklist-detection-meta"), async (ctx: Context) => { + const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; + await urql.mutation(increment, { trigger: true, mutationKey }); if (ctx.chat && ctx.msg) { diff --git a/src/bot/features/twitterBlacklist.ts b/src/bot/features/twitterBlacklist.ts index c9cb654..8acea31 100644 --- a/src/bot/features/twitterBlacklist.ts +++ b/src/bot/features/twitterBlacklist.ts @@ -11,8 +11,6 @@ const composer = new Composer(); const feature = composer.chatType(["group", "supergroup"]); -const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; - /** * What triggers this feature and adds to the log when it has been triggered. * The trigger uses the global Twitter regex to detect Twitter and X links within messages. @@ -21,6 +19,8 @@ feature.hears( twitterRegex, logHandle("blacklist-detection-twitter"), async (ctx: Context) => { + const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; + await urql.mutation(increment, { trigger: true, mutationKey }); if (ctx.chat && ctx.msg) { diff --git a/src/bot/features/welcome.ts b/src/bot/features/welcome.ts index d38d12d..5dfd401 100644 --- a/src/bot/features/welcome.ts +++ b/src/bot/features/welcome.ts @@ -8,13 +8,13 @@ const composer = new Composer(); const feature = composer.chatType("private"); -const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; - /** * What triggers this feature and adds to the log when it has been triggered. * The trigger is the command "/start" or "start" */ feature.command("start", logHandle("command-start"), async ctx => { + const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; + await urql.mutation(increment, { trigger: true, mutationKey }); await urql