mirror of
https://codeberg.org/SafeTwitch/safetwitch-backend.git
synced 2024-12-22 13:13:00 -05:00
Add logger and scripts
This commit is contained in:
parent
076bb58b7e
commit
0b02e1f2ae
2 changed files with 8 additions and 1 deletions
|
@ -21,6 +21,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"dev": "npx nodemon index.ts",
|
||||
"prod": "npx ts-node index.ts"
|
||||
"prod": "npx ts-node index.ts",
|
||||
"build": "npx tsc"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { randomUUID } from 'crypto';
|
||||
import ws from 'ws';
|
||||
import { TwitchChat } from '../util/scraping/chat/chat';
|
||||
import { logger } from '../util/logger';
|
||||
|
||||
interface ExtWebSocket extends ws {
|
||||
id?: string;
|
||||
|
@ -86,6 +87,11 @@ export class TwitchChatServer {
|
|||
|
||||
private handleHostTarget = async(channel: string, viewers: number, target: string, tags: Record<string,string>) => {
|
||||
const socketsToSend = await this.findClientsForStreamer(channel)
|
||||
.catch((err) => {
|
||||
logger.info(`No clients following ${channel}, unsubscribing`)
|
||||
})
|
||||
if(!socketsToSend) return;
|
||||
|
||||
for(let socket of socketsToSend) {
|
||||
let payload = {
|
||||
type: 'HOSTTARGET',
|
||||
|
|
Loading…
Reference in a new issue