mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 09:46:57 +01:00
add better raid handling, add real subscription handling, sub data is now also stored in redis
This commit is contained in:
13
src/index.ts
13
src/index.ts
@@ -67,6 +67,19 @@ for (const remod of bannedmods) {
|
||||
logger.info(`Set the remod timer for ${target?.displayName} to ${duration} seconds.`);
|
||||
};
|
||||
|
||||
const subs = await streamerApi.subscriptions.getSubscriptions(streamerId).then(a => a.data);
|
||||
const redisSubs = await redis.keys('user:*:subbed').then(a => a.map(b => b.slice(5, -7)));
|
||||
for (const sub of subs) {
|
||||
if (redisSubs.includes(sub.userId)) {
|
||||
const index = redisSubs.indexOf(sub.userId);
|
||||
redisSubs.splice(index, 1);
|
||||
continue;
|
||||
};
|
||||
await redis.set(`user:${sub.userId}:subbed`, sub.tier.slice(0, 1));
|
||||
};
|
||||
|
||||
redisSubs.map(async a => await redis.del(`user:${a}:subbed`));
|
||||
|
||||
const streamdata = await streamerApi.streams.getStreamByUserId(streamerId);
|
||||
if (streamdata) await redis.set('streamIsLive', '1');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user