A simple, lightweight Telegram bot built with Node.js using node-telegram-bot-api, kept online with PM2.
- Built on
node-telegram-bot-api - Express server for HTTP handling
- File type detection with
file-type - Runs 24/7 with PM2
- Easy to deploy and extend
- Node.js v16 or higher
- A Telegram bot token from @BotFather
git clone https://github.com/Loki-Xer/tg.git
cd tgCreate a .env file in the project root:
BOT_TOKEN=your_botfather_token_hereGet a token by messaging @BotFather on Telegram and sending
/newbot.
npm install && npm start| Command | Description |
|---|---|
npm start |
Start the bot with PM2 |
npm run stop |
Stop the bot |
Useful PM2 commands:
pm2 logs tg-bot # view logs
pm2 restart tg-bot # restart the botNever commit your .env file or share your bot token. Add .env to your .gitignore.
Made by Loki-Xer.