From 67ef0e448dc52ba192464e82aa19de5297216749 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Tue, 7 Feb 2017 23:11:59 +0100 Subject: [PATCH] Fix some stuff --- bot.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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()