Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import os
- import sys
- import time
- import telepot
- from telepot.loop import MessageLoop
- token='432066469:AAH8-jVofZ8JhY8M1NNlqe0A0cdyLAb-q84'
- def on_chat_cod(msg):
- content_type, chat_type, chat_id = telepot.glance(msg)
- if content_type != 'text':
- return
- else:
- cod= msg['text']
- print cod
- bot.sendMessage(chat_id,'ready')
- def on_chat_data(msg):
- content_type, chat_type,chat_id = telepot.glance(msg)
- if content_type != 'text':
- return
- else:
- data= msg['text']
- print data
- bot.sendMessage(chat_id, 'ready')
- def start(msg):
- flavor = telepot.flavor(msg)
- summary = telepot.glance(msg, flavor=flavor)
- chat_id= summary[2]
- command= msg['text']
- bot.sendMessage(chat_id,' Hi ... select a command')
- if command == '/cedula':
- bot.sendMessage(chat_id,'Insert the cod')
- on_chat_cedula(msg)
- elif command == '/data':
- bot.sendMessage(chat_id,'Insert the Data')
- on_chat_data(msg)
- bot =telepot.Bot(token)
- MessageLoop(bot,{'chat':start, 'cod':on_chat_cod, data':on_chat_data}).run_as_thread()
- print 'listening...'
- while 1:
- time.sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement