diff --git a/bot.py b/bot.py index 8ae7f4b..57c1fa1 100755 --- a/bot.py +++ b/bot.py @@ -1,12 +1,17 @@ #!/usr/bin/env python3 -import logging, telegram.ext +import logging, setuptools, telegram.ext -updater = telegram.ext.Updater(token=setuptools.token) +logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) + +updater = telegram.ext.Updater(token=setuptools.token()) def start(bot, update): - bot.sendMessage(chat_id=update.message.chat_id, text="Heeeeeeey! :3") + bot.sendMessage(chat_id=update.message.chat_id, text="Heeeeeeey! :3\n\nWelcome to the Boooooooooot!") -updater.dispatch.add_handler(telegram.ext.CommandHandler("start", start) +updater.dispatcher.add_handler(telegram.ext.CommandHandler("start", start)) -updater.start_polling() +try: + updater.start_polling() +except KeyboardInterrupt: + updater.stop()