Answer the question
In order to leave comments, you need to log in
How to update custom keyboard in telegram?
There is a bot in python, I use telebot (pyTelegramBotAPI).
/start adds a custom keyboard with several buttons to the user - ( telebot.types.ReplyKeyboardMarkup() ). Now I need to add a couple more buttons there. But the user's keyboard is updated only if he does / start again, which he is unlikely to do.
How to make it update automatically?
Answer the question
In order to leave comments, you need to log in
When sending any message, you can refresh the keyboard.
bot = telebot.TeleBot(token)
keyboard = types.ReplyKeyboardMarkup()
bot.send_message(message.chat.id, 'Сообщение', reply_markup=keyboard)
@bot.message_handler(commands=["new_keyboard_for_all_users"])
def send_new_keyboard (message):
keyboard = types.ReplyKeyboardMarkup() # Новая клавиатура
for user in users_list:
bot.send_message(user, 'Произвольное сообщение', reply_markup=keyboard)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question