skip to Main Content
from telegram.bot import Bot, BotCommand
command = BotCommand("start","To start a process")
Bot.set_my_commands([command])

i get following error

Bot.set_my_commands([command])
TypeError: set_my_commands() missing 1 required positional argument: ‘commands’

can someone explain me how to set command for a telegram bot using set_my_command()

2

Answers


  1. Chosen as BEST ANSWER

    i found answer. I haven't passed botid. And the way i passed arguement into se_my_commands()

    from telegram.bot import Bot, BotCommand
    command = [BotCommand("start","to start something"),BotCommand("stop", "to stop something")]
    bot = Bot("bot_id")
    bot.set_my_commands(command)
    

  2. you can simply use

    from pyrogram.types.bots_and_keyboards import BotCommand
    
                Bot_Client.set_bot_commands([
                BotCommand("start", "Start the bot"),
                BotCommand("settings", "Bot settings"),
            ])
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search