Перемешивание вопросов с определенными кнопками в Телеграм боте
Опять-же столкнулся с данной проблемой: хочу реализовать в телеграм боте систему перемешивания вопросов с определенными на них ответами, но у меня не получается.
import telebot
from telebot import types
import random
token = ''
bot = telebot.TeleBot(token)
spes = ["Сколько время", "Когда домой?"]
@bot.message_handler(commands = ['start'])
def start(message):
bot.send_message(message.chat.id, text = random.choice(spes))
@bot.message_handler(content_types = ['text'])
def rf(message):
if bot.message == "Сколько время":
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
k1 = types.KeyboardButton('хз')
k2 = types.KeyboardButton('Тоже хз')
markup.add(k1, k2)
bot.send_message(message.chat.id, 'wergwergh', reply_markup=markup)
def rf1(message):
if message.text == 'хз':
bot.send_message(message.chat.id, "Ага")
elif message.text == 'Тоже хз':
bot.send_message(message.chat.id, "Да")
bot.polling()
Источник: Stack Overflow на русском