Open galgeek opened 9 years ago
That would be possible when we split the message at the very beginning in its parts. So the first item will be the command which switch could work on.
Hi, @whimboo!
Many of the checks in the main listener are set to match anywhere in the message, and in the absence of else if, seem to be meant to support combinations, so I could send "Learn more about how to raise a :bug and check the :etherpad for more info about today’s tests" and get both the :bug link and the :etherpad link in reply. Do we want to change this?
Or do we want to move only the more command-like commands into a switch, maybe leaving the match-anywhere checks in the switch default.?
This is for PM messages but not for the channel. Anyway, this is an enhancement and nothing you will have to work on Barbara.
The main listener should use a switch or if / else if block for public bot commands, like :helpers, :schedule, and :optout.
See conversation in PR #46 and handling of admin commands in bot.js.