Reputation: 11
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
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
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