fbradyirl / webex_bot

Python package for a Webex Bot based on websockets.
MIT License
68 stars 44 forks source link

default help card is annoying #25

Closed rodhpadilla closed 2 years ago

rodhpadilla commented 2 years ago

Description

Any option/recommendation to stop sending the default help card (next image) everytime the user type help insted of the one I defined? image

What I Did

# action.py
class myAction(Command):
    def __init__(self):
        super().__init__(
            command_keyword="help",
            help_message="My Custom Help",
            card=START_CARD,
        )

# bot.py
bot.help_command = myAction()
help = myAction()
bot.add_command(help)
gconklin commented 2 years ago

Try this, after you instantiate the bot and the help message:

    bot.commands.remove(bot.help_command)
    bot.commands.add(my_help_command)
    bot.help_command = my_help_command
gconklin commented 2 years ago

I'm wondering if the add_command() method should also be checking command_keyword in addition to card_callback_keyword to check for duplicate commands. Which would have flagged you adding a duplicate "help" command.

rodhpadilla commented 2 years ago

Try this, after you instantiate the bot and the help message:

thanks for the quick feedback @gconklin ! Nice to know that there is a remove mothod for this cases.
Now the default help command it is the one I created