Chat-Overlay: echte Twitch-Abzeichen statt farbiger Punkte
Der Hub loest die Abzeichen aus dem IRC-Tag ueber Helix (global und Kanal) zu Bildern auf und schickt sie mit jeder Chatzeile mit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
884e4517d8
commit
67ca472317
13 files changed
+171
-19
No files matched your search
@@ -30,6 +30,7 @@ import { createBot } from '#discord/bot.ts';
|
||||
import { helix } from '#twitch/helix.ts';
|
||||
import { readSecrets } from '#twitch/secrets.ts';
|
||||
import { createEventSub } from '#twitch/eventsub.ts';
|
||||
import { createBadges } from '#twitch/badges.ts';
|
||||
import { createIrc, type UserNotice } from '#twitch/irc.ts';
|
||||
import { streamWechsel } from '#twitch/stream-state.ts';
|
||||
import { piperFehlt, sprechen, stimmenPfad } from '#media/piper.ts';
|
||||
@@ -245,6 +246,21 @@ export async function runHub(): Promise<void> {
|
||||
const bot = createBot();
|
||||
if (bot) void bot.run(abort.signal);
|
||||
|
||||
// ---- Abzeichen-Bilder fuer den Chat. Twitch aendert sie selten, ein
|
||||
// neues Abo-Abzeichen des Kanals ist nach spaetestens sechs Stunden da.
|
||||
const badges = createBadges();
|
||||
void (async () => {
|
||||
while (!abort.signal.aborted) {
|
||||
if (helix.canReadStream()) {
|
||||
const id = state.broadcasterId || cfg.channel.userId ||
|
||||
(await helix.userByLogin(cfg.channel.login).catch(() => null))?.id || null;
|
||||
if (id) state.broadcasterId = id;
|
||||
await badges.laden(id);
|
||||
}
|
||||
try { await sleep(6 * 60 * 60_000, abort.signal); } catch { return; }
|
||||
}
|
||||
})();
|
||||
|
||||
// ---- Chat
|
||||
const irc = createIrc(cfg.channel.login, {
|
||||
onConnected: (anonymous) => {
|
||||
@@ -273,6 +289,7 @@ export async function runHub(): Promise<void> {
|
||||
mod: msg.isMod,
|
||||
sub: msg.isSub,
|
||||
broadcaster: msg.isBroadcaster,
|
||||
badges: badges.aufloesen(msg.badges),
|
||||
bits: msg.bits,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user