سلام من در پایتون یک دکمه منو ساختم که یوزر با وادر کردن دستور start/ در پایین صفحه یک پیغام خوش امد می بینه و یک کیبورد با یک دکمه که نوشته شده menu
حالا اگه بخوام که وقتی کاربر روی منو کلیک میکنه بهش یک زیرمنو که مثلا 6 دکمه داره نشون بده باید چیکار کنم؟
من یک کد نوشتم ولی عمل نکرد
این کدهای بنده هست
from telegram import ReplyKeyboardMarkup , reply_markup
from telegram.ext import Updater , CommandHandler
from emoji import emojize
updater = Updater("MY_Token")
def start(bot , update):
chat_id = update.message.chat_id
text1 = emojize(':rose: <b>Welcome to ...... !</b> :rose: \n \n :information_source: In this bot you can ...... \n \n >> Lets Start!' , use_aliases=True)
bot.sendMessage(chat_id = chat_id , text = text1 , parse_mode = 'html')
mainbutton = [
['Menu']
]
keyBoard1 = ReplyKeyboardMarkup(mainbutton , resize_keyboard=True)
bot.sendMessage(chat_id = chat_id , text = "Click on Menu" , reply_markup = keyBoard1)
def menu(bot , update):
chat_id = update.message.chat_id
text2 = ("test")
bot.sendMessage(chat_id = chat_id , text = text2 , parse_mode = 'html')
menubuttons = [
['a' , 'b' ,'c'],
['d' , 'e' ,'f'],
['g' , 'h' ,'i']
]
keyBoard2 = ReplyKeyboardMarkup(menubuttons , resize_keyboard=True)
bot.sendMessage(chat_id = chat_id , text = 'Please choose one:' , reply_markup = keyBoard2)
command_start = CommandHandler('start' , start)
updater.dispatcher.add_handler(command_start)
command_Menu = CommandHandler('menu' , menu)
updater.dispatcher.add_handler(command_Menu)
#start my bot
updater.start_polling()
updater.idle()
با تشکر