mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 23:31:38 +01:00
remove vulnerable chatter system, increase redis expiry, persistant redis storage
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -32,3 +32,6 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
|||||||
|
|
||||||
# Finder (MacOS) folder config
|
# Finder (MacOS) folder config
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# Redis/Valkey database
|
||||||
|
db/redis/
|
||||||
|
|||||||
@@ -12,14 +12,6 @@ eventSub.onChannelChatMessage(streamerId, streamerId, async msg => {
|
|||||||
// Get user from cache or place user in cache
|
// Get user from cache or place user in cache
|
||||||
const user = await User.initUsername(msg.chatterName);
|
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:
|
// Parse commands:
|
||||||
if (msg.messageText.startsWith(commandPrefix)) {
|
if (msg.messageText.startsWith(commandPrefix)) {
|
||||||
const commandSelection = msg.messageText.slice(commandPrefix.length).split(' ')[0]!;
|
const commandSelection = msg.messageText.slice(commandPrefix.length).split(' ')[0]!;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { redis } from "bun";
|
|||||||
import { chatterApi } from ".";
|
import { chatterApi } from ".";
|
||||||
import { HelixUser } from "@twurple/api"
|
import { HelixUser } from "@twurple/api"
|
||||||
|
|
||||||
const EXPIRETIME = 60 * 15 // 15 minutes
|
const EXPIRETIME = 60 * 30 // 30 minutes
|
||||||
|
|
||||||
export class User {
|
export class User {
|
||||||
public username: string | undefined;
|
public username: string | undefined;
|
||||||
|
|||||||
@@ -5,3 +5,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 6379:6379
|
||||||
restart: no
|
restart: no
|
||||||
|
volumes:
|
||||||
|
- ./db/redis:/data
|
||||||
|
environment:
|
||||||
|
- VALKEY_EXTRA_FLAGS=--save 60 1
|
||||||
|
|||||||
Reference in New Issue
Block a user