Professor-Redwood-Team / Professor-Redwood

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

Incorrect parsing for messages with newlines #109

Closed kc135576 closed 5 years ago

kc135576 commented 5 years ago

Some users are issuing bot commands with newlines instead of/in addition to spaces, which is getting incorrectly parsed.

kc135576 commented 5 years ago

change

    const msglower = message.content.toLowerCase();
    const msgSplit = message.content.toLowerCase().split(' ');

to

    const msglower = message.content.toLowerCase().replace('\n', ' ');
    const msgSplit = message.content.toLowerCase().replace('\n', ' ').split(' ');

in all affected files - src/chatcommands/{egg,raid,wild,quest,tr}.js

ZVelasco commented 5 years ago

Your fix was implemented to quest. Not on the others because it removes the first word from the new line. New line reporting is never used for the other commands so not a big deal.