mozilla / testdaybot

Mozilla QA Test Day IRC Bot
9 stars 12 forks source link

update main listener to use switch / else if for bot commands #49

Open galgeek opened 9 years ago

galgeek commented 9 years ago

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.

whimboo commented 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.

galgeek commented 9 years ago

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.?

whimboo commented 9 years ago

This is for PM messages but not for the channel. Anyway, this is an enhancement and nothing you will have to work on Barbara.