add signal handler for SIGINT, SIGTERM and SIGABRT

This commit is contained in:
gcarq
2017-10-27 15:52:14 +02:00
parent 0c33e917d5
commit 4139b0b0c7
3 changed files with 38 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ logging.getLogger('requests.packages.urllib3').setLevel(logging.INFO)
logging.getLogger('telegram').setLevel(logging.INFO)
logger = logging.getLogger(__name__)
_updater = None
_updater: Updater = None
_CONF = {}
@@ -61,6 +61,14 @@ def init(config: dict) -> None:
)
def cleanup() -> None:
"""
Stops all running telegram threads.
:return: None
"""
_updater.stop()
def authorized_only(command_handler: Callable[[Bot, Update], None]) -> Callable[..., Any]:
"""
Decorator to check if the message comes from the correct chat_id