Spaces:
Sleeping
Sleeping
Download src/index.js from Discord-Core-Bot/gateway-bot: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/Discord-Core-Bot/gateway-bot/resolve/main/src/index.js
- Command line
-
hf download hf://spaces/Discord-Core-Bot/gateway-bot/src/index.js
-
curl -L -o index.js https://huggingface.co/spaces/Discord-Core-Bot/gateway-bot/resolve/main/src/index.js
1.12 kB
| 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) | |
| }) | |
| })() |