Discord & Telegram bots
The bot plans run a Node.js process that stays up around the clock: discord.js, Eris, Telegraf, grammY, node-telegram-bot-api — anything that runs on Node.
Getting your code on the server
Section titled “Getting your code on the server”Upload it. Put your project in the server’s root in Files or over SFTP: package.json, your source, and .env. Leave out node_modules/ — it’s installed for you.
Or deploy from Git. Set USER_UPLOAD to 0, GIT_ADDRESS to your repository and, for a private one, USERNAME and ACCESS_TOKEN; then reinstall. Set AUTO_UPDATE to 1 and every restart pulls the latest commit. The details are on Node & Next.js apps.
The start file
Section titled “The start file”Set MAIN_FILE in Startup to your entry point — index.js by default, or bot.ts for TypeScript (run with ts-node --esm). On each start the runtime runs npm install, prints Fleeq runtime ready, then starts your file.
Your bot token
Section titled “Your bot token”Never put the token in code. Create a .env file:
DISCORD_TOKEN=…and load it at the top of your bot:
import 'dotenv/config';const client = new Client({ intents: [GatewayIntentBits.Guilds] });client.login(process.env.DISCORD_TOKEN);If the token ever leaks, regenerate it in the Discord Developer Portal or with Telegram’s @BotFather, update .env, and restart.
Bots connect out to Discord or Telegram, so they need no port. If you use Telegram webhooks instead of long polling, listen on SERVER_PORT as described for Node apps.
Keeping it running
Section titled “Keeping it running”- A crash stops the process: read the Console for the error, fix it, and start again.
- Catch errors so one bad message can’t take the bot down:
process.on('unhandledRejection', console.error). - A daily restart via Schedules clears memory leaks in long-running bots.