File size: 1,118 Bytes
50420b6
e489270
50420b6
 
2b587a6
 
 
 
 
 
 
3fc73f4
 
 
 
 
 
 
 
 
 
 
 
50420b6
 
 
 
2b587a6
e489270
 
2b587a6
e489270
50420b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { startHealthServer } from './health.js'
import { startBot } from './bot.js'

;(async () => {
  const requiredEnvVars = ['HF_TOKEN', 'HF_BUCKET_NAME', 'DISCORD_TOKEN', 'DISCORD_CLIENT_ID']
  const missingEnvVars = requiredEnvVars.filter((v) => !process.env[v])
  if (missingEnvVars.length > 0) {
    console.error('Missing required environment variables:', missingEnvVars.join(', '))
    process.exit(1)
  }

  if (process.env.DEPLOY_COMMANDS === 'true') {
    console.log('[deploy] DEPLOY_COMMANDS=true detected, registering commands...')
    try {
      const { deployCommands } = await import('./deploy-commands.js')
      await deployCommands()
      console.log('[deploy] Commands registered successfully')
    } catch (err) {
      console.error('[deploy] Command registration failed:', err.message)
      process.exit(1)
    }
  }

  await startHealthServer().catch((err) => {
    console.error('Failed to start health server:', err)
    process.exit(1)
  })

  await startBot().catch((err) => {
    console.error('Failed to start bot:', err)
    process.exit(1)
  })
})()