Answer the question
In order to leave comments, you need to log in
How to make transition from KeyboardButton to InlineKeyboard keyboard?
Tell me how, when you click on the KeyboardButton button, go to InlineKeyboard to the telegram group link and 2 buttons, when you click it, InlineKeyboard appears with text.
@dp.message_handler(commands=['start'])
async def start_process_command(message:types.Message):
button_create_mp = KeyboardButton(' ссылка группы,с переходом на InlineKeyboard')
button_about_bot = KeyboardButton(' Инструкция,с переходом на InlineKeyboard')
favoutite_channels = KeyboardButton('✅и тут кнопка, с переходом на InlineKeyboard ')
create_mp = ReplyKeyboardMarkup(resize_keyboard=True).row(button_create_mp)
create_mp.add(favoutite_channels, button_about_bot)
btn_add_channel = KeyboardButton('Готово')
mp_btn = ReplyKeyboardMarkup(resize_keyboard=True)
mp_btn.add(btn_add_channel)
await bot.send_message(message.from_user.id,text=' Здесь так же, код заменить без текста ' + message.from_user.first_name + '!'+' Здесь так же, код заменить без текста.', reply_markup=create_mp)
@dp.message_handler(commands=['help'])
async def help_command_process(message: types.Message):
await bot.send_message(message.from_user.id, text="Помощь \n Здесь так же, код заменить без текста")
@dp.message_handler(lambda m: m.chat.type == 'group')
async def check(message: types.Message):
if message.text == '✅ Готово':
if message.forward_from.type == 'group':
member = bot.get_chat_member(message.forward_from, bot.me.id)
if member.is_admin:
if member.can_post_messages:
await bot.send_message(message.from_user.id, text='Здесь так же, код заменить без текста')
else:
await bot.send_message(message.from_user.id, text='Здесь так же, код заменить без текста')
@dp.message_handler()
async def echo_message(message: types.Message):
btn_add_channel = KeyboardButton('✅ Готово')
btn_back = KeyboardButton('↩️ Назад')
mp_btn = ReplyKeyboardMarkup(resize_keyboard=True).row(btn_add_channel)
mp_btn.add(btn_back)
if message.text == "➕ группа":
await bot.send_message(message.from_user.id, text="этот код заменить без текста", reply_markup=mp_btn)
if message.text == "↩️ Назад":
await bot.send_message(message.from_user.id, text="Главное меню:")
Answer the question
In order to leave comments, you need to log in
I do not quite understand the complexity of the task.
main = types.InlineKeyboardMarkup()
m = types.InlineKeyboardButton("Клик", callback_data = "click")
main.add(m)
reply_markup = main
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question