Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
Geczy committed Aug 1, 2023
1 parent 3f733fe commit 8026cfb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
23 changes: 22 additions & 1 deletion packages/twitch/events/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
import { Account } from '@dotabod/prisma/dist/psql/index'
import { EnvPortAdapter, EventSubHttpListener } from '@twurple/eventsub-http'
import express from 'express'
import { Server } from 'socket.io'

import { handleNewUser } from './handleNewUser.js'
import { SubscribeEvents } from './SubscribeEvents.js'
import BotAPI from './twitch/lib/BotApiSingleton.js'
import { getAccountIds } from './twitch/lib/getAccountIds.js'
import './twitch/events/index.js'

export const io = new Server(5015)
export const DOTABOD_EVENTS_ROOM = 'twitch-channel-events'
export let eventsIOConnected = false

io.on('connection', (socket) => {
console.log('Joining socket')
try {
void socket.join(DOTABOD_EVENTS_ROOM)
console.log('Joined socket DOTABOD_EVENTS_ROOM')
} catch (e) {
console.log('could not join socket DOTABOD_EVENTS_ROOM', { e })
return
}

eventsIOConnected = true

socket.on('disconnect', () => {
eventsIOConnected = false
})
})

if (!process.env.EVENTSUB_HOST || !process.env.TWITCH_EVENTSUB_SECRET) {
throw new Error('Missing EVENTSUB_HOST or TWITCH_EVENTSUB_SECRET')
Expand Down
21 changes: 0 additions & 21 deletions packages/twitch/events/src/twitch/events/index.ts

This file was deleted.

0 comments on commit 8026cfb

Please sign in to comment.