При выборе на второй клавиатуре в телеграме (aiogram) сообщение не приходит
При выборе на второй клавиатуре в телеграме (aiogram) сообщение не приходит. те здесь:
if message.text == "1" or message.text == "2" or message.text == "3" or message.text == "4":
await bot.send_message(chat_id=message.from_user.id,
text="""текст
текст
текст
текст
текст""",
reply_markup=ReplyKeyboardRemove())
kb = ReplyKeyboardMarkup(resize_keyboard=True)
kb.add(KeyboardButton('вариант1')).insert(KeyboardButton('вариант2'))
kb2 = ReplyKeyboardMarkup(resize_keyboard=True)
kb2.add(KeyboardButton('1')).insert(KeyboardButton('2')).add(KeyboardButton('3')).add(KeyboardButton('4'))
async def on_startup(_):
print('Бот запущен')
photo = types.InputFile('path_to_photo.jpg')
@dp.message_handler(commands=['start'])
async def send_welcome(message: types.Message):
await bot.send_photo(chat_id=message.from_user.id,
photo=photo,
caption="""текст
текст""",
reply_markup=kb)
@dp.message_handler()
async def send_golda(message: types.Message):
if message.text == 'вариант1':
await bot.send_message(chat_id=message.from_user.id,
text="""текст
текст""",
reply_markup=ReplyKeyboardRemove())
await bot.send_message(chat_id=message.from_user.id,
text="текст",
reply_markup = kb2)
if message.text == "1" or message.text == "2" or message.text == "3" or message.text == "4":
await bot.send_message(chat_id=message.from_user.id,
text="""текст
текст
текст
текст
текст""",
reply_markup=ReplyKeyboardRemove())
Источник: Stack Overflow на русском