Can somebody help, I cant understand how can I do my bot with two menus. first - is "short menu" where you press the button and its open "long menu" with all functions second - in "long menu" menu where I have all functions and the button "Back to Menu". I cant understnand how to make the button "Back to Menu" that go back me to the "short menu" help me please. And the Main -- the clicking on buttons should not send a message to the user
def telegram():
with open("madata") as f3:
info = yaml.safe_load(f3)
token = mytoken
bot = Bot(token=token)
dp = Dispatcher(bot)
#greeting message, pin this message in private chat
@dp.message_handler(commands=['start'])
async def greeting(message: types.Message):
chat_id = message.chat.id
msg = '''hello friend'''
# body of keyboard
small_function = ReplyKeyboardMarkup(
keyboard = [
[
KeyboardButton(text="show functions", callback_data='open menu all functions')
]
],
resize_keyboard=True
)
all_functions = ReplyKeyboardMarkup(
keyboard = [
[
KeyboardButton(text="function 1", callback_data='do function1')
],
[
KeyboardButton(text="function 2", callback_data='do function2')
],
[
KeyboardButton(text="back to menu", callback_data=' open menu small_function')
],
],
resize_keyboard=True
)
#insert my keyboard
sent_message = await bot.send_message(chat_id=chat_id, text=msg,parse_mode = "Markdown", reply_markup=small_function)
print(sent_message.message_id)
@bot.callback_query_handler(func=lambda call: True)
async def answer(call):