fbradyirl / webex_bot

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

Fixed issue where command keyword is not always stripped, depending o… #16

Closed 0x2142 closed 2 years ago

0x2142 commented 2 years ago

The get_message_passed_to_command function strips the command keyword from the message sent by the user, however this only happens if the capitalization matches. In testing, if the command sent by the user has different capitalization ("Command" vs "command"), then the command keyword is not stripped.

I added a quick change to the get_message_passed_to_command function to fix this.

For example, using a sample bot command that will echo the received message:

class TestCommand(Command):
    def __init__(self):
        super().__init__(
            command_keyword="test",
            help_message="test command.",
            card=None,
        )

    def execute(self, message, attachment_actions, activity):
        return ("Received message: " + message)

Then we see the following responses from the bot: bot issue

Test reports:

webex_bot commit
Zenegrad commented 2 years ago

++