Archana Achu
Archana Achu

Reputation: 11

Bot.set_my_command() using this function how to set commands and how to pass arguements

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()

Upvotes: 0

Views: 4754

Answers (2)

Ugochukwu Nwokolo
Ugochukwu Nwokolo

Reputation: 1

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"),
        ])

Upvotes: 0

Archana Achu
Archana Achu

Reputation: 11

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)

Upvotes: 1

Related Questions