Skip to content

Instantly share code, notes, and snippets.

@zulman
Created May 5, 2016 16:42
Show Gist options
  • Save zulman/fd4ae7ac37f05a6bf7eaa331ba39b2f3 to your computer and use it in GitHub Desktop.
Save zulman/fd4ae7ac37f05a6bf7eaa331ba39b2f3 to your computer and use it in GitHub Desktop.
#!/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