Created
May 5, 2016 16:42
-
-
Save zulman/fd4ae7ac37f05a6bf7eaa331ba39b2f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import traceback | |
import threading | |
from telegram.ext import Updater, CommandHandler | |
def start(bot, update): | |
s = "" | |
for line in traceback.format_stack(): | |
s = s + line.strip() +"\n" | |
s = s + str(threading.current_thread()) + "\n" | |
bot.sendMessage(chat_id=update.message.chat_id, text=s) | |
def error(bot, update, error): | |
print 'Update "%s" caused error "%s"' % (update, error) | |
updater = Updater(token='*') | |
dispatcher = updater.dispatcher | |
start_handler = CommandHandler('start', start) | |
dispatcher.addHandler(start_handler) | |
dispatcher.addErrorHandler(error) | |
updater.start_polling() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment