Skip to content

Instantly share code, notes, and snippets.

@nghiaht
Last active November 12, 2023 06:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nghiaht/922bfaf2a0e95f5d9fbbb3e1df4ec4bb to your computer and use it in GitHub Desktop.
Save nghiaht/922bfaf2a0e95f5d9fbbb3e1df4ec4bb to your computer and use it in GitHub Desktop.
Auto restart Telegram bot using telegraf
const Telegraf = require("telegraf");
const bot = new Telegraf("TOKEN");
bot.catch((err) => {
console.error('Ooops', err);
process.exit(1); // I choose exit, you should use PM (Process Manager) and let them automatically restart the bot
// Or sth else
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment