Skip to content

Commit

Permalink
fix: bets overlay wasn't sending
Browse files Browse the repository at this point in the history
  • Loading branch information
Geczy committed Sep 22, 2023
1 parent 5836473 commit db3cc16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions packages/twitch/events/src/SubscribeEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import { onlineEvent } from './twitch/lib/onlineEvent.js'
import { updateUserEvent } from './twitch/lib/updateUserEvent.js'
import { DOTABOD_EVENTS_ROOM, eventsIOConnected, socketIo } from './utils/socketUtils.js'

export const handleEvent = (eventName: any, data: any) => {
export const handleEvent = (eventName: any, broadcasterId: string, data: any) => {
if (!eventsIOConnected) {
console.log('[TWITCHEVENTS] No socket connection')
return
}
console.log('[TWITCHEVENTS] Emitting event', { eventName, data })
socketIo.to(DOTABOD_EVENTS_ROOM).emit('event', eventName, data.broadcasterId, data)
socketIo.to(DOTABOD_EVENTS_ROOM).emit('event', eventName, broadcasterId, data)
}

export const SubscribeEvents = (accountIds: string[]) => {
Expand All @@ -24,37 +22,37 @@ export const SubscribeEvents = (accountIds: string[]) => {
promises.push(listener.onUserUpdate(userId, updateUserEvent))
promises.push(
listener.onChannelPredictionBegin(userId, (data) =>
handleEvent('onChannelPredictionBegin', transformBetData(data)),
handleEvent('onChannelPredictionBegin', userId, transformBetData(data)),
),
)
promises.push(
listener.onChannelPredictionProgress(userId, (data) =>
handleEvent('onChannelPredictionProgress', transformBetData(data)),
handleEvent('onChannelPredictionProgress', userId, transformBetData(data)),
),
)
promises.push(
listener.onChannelPredictionLock(userId, (data) =>
handleEvent('onChannelPredictionLock', transformBetData(data)),
handleEvent('onChannelPredictionLock', userId, transformBetData(data)),
),
)
promises.push(
listener.onChannelPredictionEnd(userId, (data) =>
handleEvent('onChannelPredictionEnd', transformBetData(data)),
handleEvent('onChannelPredictionEnd', userId, transformBetData(data)),
),
)
promises.push(
listener.onChannelPollBegin(userId, (data) =>
handleEvent('onChannelPollBegin', transformPollData(data)),
handleEvent('onChannelPollBegin', userId, transformPollData(data)),
),
)
promises.push(
listener.onChannelPollProgress(userId, (data) =>
handleEvent('onChannelPollProgress', transformPollData(data)),
handleEvent('onChannelPollProgress', userId, transformPollData(data)),
),
)
promises.push(
listener.onChannelPollEnd(userId, (data) =>
handleEvent('onChannelPollEnd', transformPollData(data)),
handleEvent('onChannelPollEnd', userId, transformPollData(data)),
),
)
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pull() {
push() {
docker_login
buildall
docker_command push twitch-events dota twitch-chat steam
docker_command push twitch-events
}

buildall() {
Expand Down

0 comments on commit db3cc16

Please sign in to comment.