diff --git a/telebot/__init__.py b/telebot/__init__.py index d6c16e1..992e5fb 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -302,9 +302,9 @@ class TeleBot: except KeyboardInterrupt: logger.info("KeyboardInterrupt received.") self.__stop_polling.set() - polling_thread.stop() break + polling_thread.stop() logger.info('Stopped polling.') def __non_threaded_polling(self, none_stop=False, interval=0, timeout=3): @@ -341,6 +341,11 @@ class TeleBot: def stop_polling(self): self.__stop_polling.set() + def stop_bot(self): + self.stop_polling() + if self.worker_pool: + self.worker_pool.close() + def set_update_listener(self, listener): self.update_listener.append(listener)