Created
January 23, 2017 07:01
-
-
Save kostyakoz/3cdfa8c24faee674ab6baf4e34d5b74c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
bot = telebot.TeleBot('TOKEN') | |
@bot.message_handler(commands=['start']) | |
def start(m): | |
msg = bot.send_message(m.chat.id, 'Как тебя зовут?') # сохраняем данные сообщения в msg | |
bot.register_next_step_handler(msg, hello) # переводим пользователя в функцию hello | |
def hello(m): | |
# следующее сообщение от пользователя попадёт сюда | |
bot.send_message(m.chat.id, '{}, привет!'.format(m.text)) # m.text это текст от пользователя, его имя | |
bot.send_message(m.chat.id, 'Задай мне вопрос.') # это сообщение можно объеденить с предыдущим |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment