Monday, 29 March 2021

telebot won't stop and start

I'm trying to restart my bot every 10 seconds(for testing I want to do it every 10 minutes or so) or so and I can't seem to be able to do it. I've tried:

const TeleBot = require('telebot');
const bot = new TeleBot({
  token:'mytoken',
  polling:true
});

setInterval(function(){ bot.start()},9000);
setInterval(function(){ bot.stop()},10000); 

It says that the bot starts and stops, however when it does it the second time it says:

[bot.error.update] { ok: false, error_code: 409, description: 'Conflict: terminated by other getUpdates request; make sure that only one bot instance is running' }

But if the bot is stopped there should only be no instance of the bot running. Is there a way to completely stop the bot?



from telebot won't stop and start

No comments:

Post a Comment