Skip to content

Instantly share code, notes, and snippets.

@kostyakoz
Created January 23, 2017 07:01
Show Gist options
  • Save kostyakoz/3cdfa8c24faee674ab6baf4e34d5b74c to your computer and use it in GitHub Desktop.
Save kostyakoz/3cdfa8c24faee674ab6baf4e34d5b74c to your computer and use it in GitHub Desktop.
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