skip to Main Content

enter image description here

I want create like this button. HOW?

@bot.message_handler(commands=["start", "help"])

I wrote the suggested words but they did not appear to the user like the attached image. What is the reason?
Is there something called a list in the library or something like that?

2

Answers


  1. Chosen as BEST ANSWER

    I found the answer by using @bot.message_handler() def welcome_message(message): c1 = types.BotCommand( command="start", description="Click to start the bot" ) # Create a command for the user to start the bot bot.set_my_commands([c1]) # Set the available commands bot.set_chat_menu_button( message.chat.id, types.MenuButtonCommands("commands")


  2. You can talk to @BotFather and create a commands list for your bot.

    How to:

    1. Open @BotFather
    2. Send /mybots
    3. Choose your bot from the buttons
    4. Press Edit Bot
    5. Press Edit Commands
    6. Now send your desired commands to be shown with its description as the format asked by @BotFather
      (command1 - Description)

    You can actually programmatically do this as well. Please refer to the setMyCommands method.

    Hope this helps!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search