mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 10:56:57 +01:00
28 lines
787 B
TypeScript
28 lines
787 B
TypeScript
import { eventSub } from "index";
|
|
import { sendMessage } from "lib/commandUtils";
|
|
import { redis } from "lib/redis";
|
|
import { streamerId } from "main";
|
|
import { sendDiscordMessage } from "web/discordConnection";
|
|
|
|
eventSub.onStreamOnline(streamerId, async (msg) => {
|
|
await Promise.all([
|
|
redis.set("streamIsLive", "1"),
|
|
sendMessage(
|
|
`${msg.broadcasterDisplayName.toUpperCase()} IS LIVE! START DIGGING!`,
|
|
),
|
|
sendDiscordMessage({ message: "live" }),
|
|
redis
|
|
.keys("user:*:haschattedthisstream")
|
|
.then((a) => a.map(async (b) => await redis.del(b))),
|
|
]);
|
|
});
|
|
|
|
eventSub.onStreamOffline(streamerId, async (msg) => {
|
|
await Promise.all([
|
|
redis.del("streamIsLive"),
|
|
sendMessage(
|
|
`${msg.broadcasterDisplayName.toUpperCase()} IS OFFLINE! NO MORE FREE LOOT!`,
|
|
),
|
|
]);
|
|
});
|