Created
May 9, 2018 15:31
-
-
Save b0g3r/fb43495b97a5685daa1f0cfadd6d93b2 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
import telebot | |
token = '549970082:AAEJFMftKR9VbC-jyv2O--QbWzriyfFfjI0' | |
bot = telebot.TeleBot(token) | |
states = {} | |
@bot.message_handler(func=lambda m: states.get(m.chat.id, 0) ==0) | |
def stat0(message): | |
text = message.text | |
if text == 'дай мне новости': | |
response ='вот новости на сегодня' | |
states[message.chat.id] = 1 | |
else: | |
response = 'есть вапросы?' | |
bot.send_message(message.chat.id, response) | |
@bot.message_handler(func=lambda m: states.get(m.chat.id, 0) ==1) | |
def state1(message): | |
import random | |
text = message.text | |
if text == 'всё': | |
states[message.chat.id] = 0 | |
choice=['ммм...', 'хорошо', 'давай по новой'] | |
bot.send_message (message.chat.id, | |
random.choice(choice)) | |
bot.polling() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment