store mods on redis, just like timeouts

This commit is contained in:
2025-07-29 18:51:53 +02:00
parent cde679e583
commit 9d873fc54e
5 changed files with 22 additions and 8 deletions

View File

@@ -35,10 +35,16 @@ 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));
if (ban.expiryDate) redis.expire(`user:${ban.userId}:timeout`, Math.floor((ban.expiryDate.getTime() - Date.now()) / 1000) + 1);
logger.info(`Set the timeout/ban of ${ban.userDisplayName} in the Redis/Valkey database.`);
});
const mods = await streamerApi.moderation.getModerators(streamerId).then(a => a.data);
mods.forEach(async mod => {
await redis.set(`user:${mod.userId}:mod`, '1');
logger.info(`Set the mod status of ${mod.userDisplayName} in the Redis/Valkey database.`);
});
await import("./events");
await import("./web");