L
L
Luca2021-09-15 08:35:21
Python
Luca, 2021-09-15 08:35:21

How to update the keyboard in telegram bot?

Added a couple of new features to the keyboard, but it will be updated if the user writes / start again, which, in fact, is unlikely to be done. How to ensure that the keyboard is updated for all users? Maybe there is someone who has experienced this. Thanks in advance! Here is the code:

import telebot

bot = telebot.TeleBot("---")

keyboard = telebot.types.ReplyKeyboardMarkup(True)
keyboard.row('---')
keyboard.row('---')
keyboard.row('---')
keyboard.row('---')
keyboard.row('---')

---="---"
def send(id,text):
    bot.send_message(id, text, reply_markup = keyboard)


@bot.message_handler(commands=['start'])
def answer(message):
    send(message.chat.id, "---")
    send(message.chat.id, "---")

@bot.message_handler(content_types=['text'])
def main(message):
    id = message.chat.id
    msg = message.text

    if msg == "---":
        p = open("---.jpg", 'rb')
        bot.send_photo(id, p)

    elif msg == "---":
        bot.send_message(id, "---")

    elif msg == "---":
        r = open("---.jpg", 'rb')
        bot.send_photo(id, r)

    elif msg == "---":
        bot.send_message(id, ---)

    elif msg == "Связь со мной":
        bot.send_message(id,'--- ---' )

    elif msg == "---":
        bot.send_message(id, "---")
        m = open("---",'rb')
        bot.send_document(id, m)

    elif msg == "---":
        bot.send_message(id, "---")
        u = open("---.docx", 'rb')
        bot.send_document(id, u)


    elif msg == "---":
        bot.send_message(id, "---")
        i = open("---.doc",'rb')
        bot.send_document(id, i)



bot.polling(none_stop = True)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stefan, 2021-09-15
@MEDIOFF

Put a temporary handler on any message, and update the keyboard in it, if you do not want a separate command, or send a message to everyone to write / start and update the keyboard

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question