diff --git a/src/index.ts b/src/index.ts index c059401..1193a41 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,8 +35,11 @@ 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) + 1); - logger.info(`Set the timeout/ban of ${ban.userDisplayName} in the Redis/Valkey database.`); + const banlength = ban.expiryDate; + if (banlength) { + redis.expire(`user:${ban.userId}:timeout`, Math.floor((ban.expiryDate.getTime() - Date.now()) / 1000) + 1); + logger.info(`Set the timeout of ${ban.userDisplayName} in the Redis/Valkey database.`); + }; }); const mods = await streamerApi.moderation.getModerators(streamerId).then(a => a.data);