[O] Exit on keyboard interrupt
This commit is contained in:
+8
-1
@@ -11,6 +11,7 @@ from src.utils import createCommand
|
||||
if __name__ == '__main__':
|
||||
# Initialize logger
|
||||
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
|
||||
logging.getLogger('apscheduler.executors.default').propagate = False
|
||||
|
||||
# Create bot
|
||||
bot = telegram.Bot(token=token)
|
||||
@@ -34,4 +35,10 @@ if __name__ == '__main__':
|
||||
|
||||
# Keep alive
|
||||
while True:
|
||||
time.sleep(5)
|
||||
try:
|
||||
time.sleep(5)
|
||||
except KeyboardInterrupt:
|
||||
print("Exiting...")
|
||||
updater.stop()
|
||||
dispatcher.stop()
|
||||
exit(0)
|
||||
|
||||
Reference in New Issue
Block a user