From 37a38eb9e06f9017a2293e40e47ccf821ec210db Mon Sep 17 00:00:00 2001 From: qwerinope Date: Sun, 1 Jun 2025 13:56:55 +0200 Subject: [PATCH] remove vulnerable chatter system, increase redis expiry, persistant redis storage --- .gitignore | 3 +++ bot/events/message.ts | 8 -------- bot/user.ts | 2 +- compose.yml | 4 ++++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index a14702c..902ca7e 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,6 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json # Finder (MacOS) folder config .DS_Store + +# Redis/Valkey database +db/redis/ diff --git a/bot/events/message.ts b/bot/events/message.ts index a1f1667..86d4c32 100644 --- a/bot/events/message.ts +++ b/bot/events/message.ts @@ -12,14 +12,6 @@ eventSub.onChannelChatMessage(streamerId, streamerId, async msg => { // Get user from cache or place user in cache const user = await User.initUsername(msg.chatterName); - // Manage vulnerable chatters - if (![chatterId, streamerId].includes(msg.chatterId)) {// Don't add the chatter or streamer to the vulnerable chatters - if (!await redis.sismember("vulnchatters", msg.chatterId)) { - await redis.sadd('vulnchatters', msg.chatterId); - console.debug(`${msg.chatterDisplayName} is now vulnerable to explosives.`); - }; - }; - // Parse commands: if (msg.messageText.startsWith(commandPrefix)) { const commandSelection = msg.messageText.slice(commandPrefix.length).split(' ')[0]!; diff --git a/bot/user.ts b/bot/user.ts index bf5a187..dc16444 100644 --- a/bot/user.ts +++ b/bot/user.ts @@ -2,7 +2,7 @@ import { redis } from "bun"; import { chatterApi } from "."; import { HelixUser } from "@twurple/api" -const EXPIRETIME = 60 * 15 // 15 minutes +const EXPIRETIME = 60 * 30 // 30 minutes export class User { public username: string | undefined; diff --git a/compose.yml b/compose.yml index 3495453..c0e3ae8 100644 --- a/compose.yml +++ b/compose.yml @@ -5,3 +5,7 @@ services: ports: - 6379:6379 restart: no + volumes: + - ./db/redis:/data + environment: + - VALKEY_EXTRA_FLAGS=--save 60 1