From 0076d791b4e414bc014dc3a411ad9440d55da0cd Mon Sep 17 00:00:00 2001 From: BarsTiger Date: Wed, 25 Oct 2023 13:26:13 +0300 Subject: [PATCH] Add suppress KeyboardInterrupt --- bot/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot/__init__.py b/bot/__init__.py index 4428f57..f027e1b 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -1,4 +1,5 @@ from rich import print +import contextlib async def runner(): @@ -25,4 +26,7 @@ def main(): apply() print('Starting...') - asyncio.run(runner()) + with contextlib.suppress(KeyboardInterrupt): + asyncio.run(runner()) + + print('[red]Stopped.[/]')