Exemple #1
0
from parse import Menu
from phrases import Phrase
from datetime import datetime
from random import randint, shuffle
import re
import sys

msgTxt = 'toc toc,ton?ton!tic;tac.tix\ntox+tox¿tox-tox*tox/toz=tiz'
#msgTokens = re.split(' |,|;|.|:|!|?|¡|¿|+|-|*|/|=|"|\\', msgTxt)
tokens = re.split(',|;|!|\?|\.|\+|-|\*|/|=|¿|\s', msgTxt)
for t in tokens:
	print t
sys.exit(0)

m = Menu()
p = Phrase()
rests = m.getRestaurants()

for i in range(20):
	rest = p.rnd(rests)
	foods = m.getFoods(rest)
	food = p.rnd(foods)
	try:
		print u"At " + rest + u"\t eat " + food	

	except:
		print " ========> Decode exception : " + food

	if("?" in food):
		print "contains ?"
Exemple #2
0




"""
Send a message to a user
"""
chat_id = update.message.chat.id;x


print("chat_id:          ", chat_id)
print("----------")

reply_markup = ForceReply(True, False)
result = bot.send_message(chat_id, Menu.menu(), reply_markup=reply_markup).wait()
print(">>>>" + str(result))

sys.exit(0)

"""
Get updates sent to the bot
"""
updates = bot.get_updates().wait()
for update in updates:
	print('---')
	print(update)

"""
Use a custom keyboard
"""