Skip to content

Commit

Permalink
Enable graceful stop
Browse files Browse the repository at this point in the history
  • Loading branch information
olpeh committed Jul 6, 2023
1 parent a967ea7 commit af3562b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/src/telegramBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export const setupTelegramBot = (botToken, redisClient, cacheKey) => {
bot.command('status', ctx => replyWithStatus(ctx.reply));
bot.launch();
console.log('Bot listening to messages and commands...');

// Enable graceful stop
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));
} else {
console.warn('Telegram bot token was missing... ignoring');
}
Expand Down

0 comments on commit af3562b

Please sign in to comment.