mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 09:01:38 +01:00
add stats command to readme, implement optional stacking timeouts, fully rework timeout management
This commit is contained in:
@@ -4,6 +4,7 @@ import { EventSubWsListener } from "@twurple/eventsub-ws";
|
||||
import { addAdmin } from "lib/admins";
|
||||
import logger from "lib/logger";
|
||||
import { addInvuln } from "lib/invuln";
|
||||
import { redis } from "bun";
|
||||
|
||||
const CHATTERINTENTS = ["user:read:chat", "user:write:chat", "user:bot"];
|
||||
const STREAMERINTENTS = ["user:read:chat", "moderation:read", "channel:manage:moderators", "moderator:manage:banned_users", "bits:read", "channel:moderate"];
|
||||
@@ -31,6 +32,13 @@ export const commandPrefix = process.env.COMMAND_PREFIX ?? "!";
|
||||
export const streamerUsers = [chatterId, streamerId];
|
||||
streamerUsers.forEach(async id => await Promise.all([addAdmin(id), addInvuln(id)]));
|
||||
|
||||
const banned = await streamerApi.moderation.getBannedUsers(streamerId).then(a => a.data);
|
||||
banned.forEach(async ban => {
|
||||
await redis.set(`user:${ban.userId}:timeout`, '1');
|
||||
if (ban.expiryDate) redis.expire(`user:${ban.userId}:timeout`, Math.floor((ban.expiryDate.getTime() - Date.now()) / 1000));
|
||||
logger.info(`Set the timeout/ban of ${ban.userDisplayName} in the Redis/Valkey database.`);
|
||||
});
|
||||
|
||||
await import("./events");
|
||||
|
||||
await import("./web");
|
||||
|
||||
Reference in New Issue
Block a user