Answer the question
In order to leave comments, you need to log in
How to implement adding buttons from the telebot admin panel?
I'm trying to make a "menu" bot, where through the admin panel you can edit the same bot, that is, edit inline buttons or content. Well, I collected the name of the button and callback (or url) from the user. Well, I put this stuff in the database .. and then what? How to implement adding a keyboard if there is info about it in the database?
Answer the question
In order to leave comments, you need to log in
We get buttons from the database in the form of an array or a multidimensional array, if with callback data:
buttons = db.get_main_buttons()
Next, we add buttons (Example without calldata):
k = types.ReplyKeyboardMarkup()
for b in buttons:
k.add(types.KeyboardButton(b))
bot.send_message(message.chat.id, "TEXT", reply_markup=k)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question