Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import sys
  2. import time
  3. import telepot
  4. import mysql
  5.  
  6. def handle(msg):
  7. content_type, chat_type, chat_id = telepot.glance(msg)
  8. print(content_type, chat_type, chat_id)
  9.  
  10. if content_type == 'text':
  11. bot.sendMessage(chat_id, msg['text'])
  12.  
  13. #TOKEN = sys.argv[1] # get token from command-line
  14. TOKEN = '305321080:AAHQTqiX6ok4kR2HEMdlejOJ_Cp5NZqpYUA'
  15. bot = telepot.Bot(TOKEN)
  16. bot.message_loop(handle)
  17. print ('Listening ...')
  18.  
  19. # Keep the program running.
  20. while 1:
  21. time.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement