Skip to content

Commit

Permalink
add ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Geczy committed Sep 19, 2023
1 parent aecb44d commit 5a9f0c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/twitch/events/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import express from 'express'
import { Server as SocketServer } from 'socket.io'
import { io } from 'socket.io-client'

import { Tables } from './db/supabase-types.js'
import { handleNewUser } from './handleNewUser.js'
import { SubscribeEvents } from './SubscribeEvents.js'
import BotAPI from './twitch/lib/BotApiSingleton.js'
Expand Down Expand Up @@ -127,7 +128,7 @@ webhookApp.post('/', express.json(), express.urlencoded({ extended: true }), (re

if (req.body.type === 'INSERT' && req.body.table === 'accounts') {
const { body } = req
const user = body.record
const user = body.record as InsertPayload<Tables<'accounts'>>['record']
if (IS_DEV && !DEV_CHANNELIDS.includes(user.providerAccountId)) return
if (!IS_DEV && DEV_CHANNELIDS.includes(user.providerAccountId)) return

Expand All @@ -145,8 +146,8 @@ webhookApp.post('/', express.json(), express.urlencoded({ extended: true }), (re
})
} else if (req.body.type === 'UPDATE' && req.body.table === 'users') {
const { body } = req
const oldUser = body.old_record
const newUser = body.record
const oldUser = body.old_record as UpdatePayload<Tables<'users'>>['old_record']
const newUser = body.record as UpdatePayload<Tables<'users'>>['record']

if (IS_DEV && !DEV_CHANNELS.includes(newUser.name)) return
if (!IS_DEV && DEV_CHANNELS.includes(newUser.name)) return
Expand Down

0 comments on commit 5a9f0c0

Please sign in to comment.