mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-20 01:33:59 +00:00
20 lines
659 B
TypeScript
20 lines
659 B
TypeScript
import { api, discord, logger } from '$/context'
|
|
import { getMissingEnvironmentVariables } from '@revanced/bot-shared'
|
|
|
|
import './events/register'
|
|
|
|
// Check if token exists
|
|
const missingEnvs = getMissingEnvironmentVariables(['DISCORD_TOKEN', 'DATABASE_PATH'])
|
|
if (missingEnvs.length) {
|
|
for (const env of missingEnvs) logger.fatal(`${env} is not defined in environment variables`)
|
|
process.exit(1)
|
|
}
|
|
|
|
// Handle uncaught exceptions
|
|
|
|
process.on('uncaughtException', error => console.error('Uncaught exception:', error))
|
|
process.on('unhandledRejection', reason => console.error('Unhandled rejection:', reason))
|
|
|
|
api.client.connect()
|
|
discord.client.login()
|