fbradyirl / webex_bot

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

Remove bot first name from message #32

Closed fbradyirl closed 2 years ago

gconklin commented 2 years ago

"replace" may be overreaching

>>> botname = "the therapist"
>>> message = "hello the therapist, what's the word"
>>> print(message.replace(botname.split()[0], '').strip())
hello  rapist, what's  word

("the" removed three times)

fbradyirl commented 2 years ago

Agreed. This was a commit from another user and will circle back for them to try another fix.

ciaranjordan commented 2 years ago

Yes I hadn't tested this before pushing to my branch.

There's more considerations too in addition to the above, like does Webex include 2 or more parts of the name if there is a conflict or does it include the whole thing.

I guess this is why so many bots (on Webex and other platforms) use slash commands or similar, you can just parse the message after the slash and ignore everything in front of it.