Professor-Redwood-Team / Professor-Redwood

Pokemon Go Discord Bot
MIT License
34 stars 21 forks source link

Distinguishing Commands #37

Closed mralanlee closed 6 years ago

mralanlee commented 7 years ago

sparklerfish L36 Mystic - Today at 7:43 AM

Is there any way to have the bot distinguish between a command run in the wrong channel and a misspelled command/something that isn't a command? Sometimes people accidentally mix up the format for the raid command and do something like !moltres 54 whatever location and the bot tells them "this command can only be run in #professor_redwood ". For things that aren't commands, could it say something like "Command not found. Type !help in #professor_redwood for help."

I was thinking that we could change up the way the commands are setup. Currently we are using if statements to process each command. It may be better to use something like switch and case statements to evaluate the commands that come in, and it would make the cases more readable.

flippinjoe commented 7 years ago

I think the command routing system needs an overhaul in general. Ideally the routing commands would all conform to an abstract class to ensure certain commands.

canRespondToMessage handleMessage

Then the chat router simply takes all messages and loops through the chat command files and finds the first one that canRespond and returns the result of handleMessage

adorableducky commented 6 years ago

As a quick workaround to this issue, can we add a "minor text fix" in professor redwood's response to encourage people to try again? Right now it directs people to go to #professor_redwood but the !wild, !raid, and !egg commands need to be in the neighborhood channel. Perhaps something like (suggested by AdoptEmAll): "If you're trying to report an egg, a raid, or a Pokémon in the wild, use !egg, !raid, or !wild respectively. Otherwise, this command can only be run in #professor_redwood".

Thanks so much for all the hard work so far!

adorableducky commented 6 years ago

Other quick workaround request: can professor redwood respond to anything that starts with !nests to "see the pinned messages in #general_pogo_chat" ? Thanks again!