knights-of-academia / horace

discord.js bot powering the Knights of Academia server with commands like info, AFK, and more
MIT License
23 stars 19 forks source link

Move message reactions into one function #281

Closed debashisbiswas closed 3 years ago

debashisbiswas commented 3 years ago

There were a bunch of functions around the codebase with the same repeated pattern: check if message is in a certain channel, check if it includes a string, if so, react with emote. Rather than repeating this pattern everywhere, this PR abstracts that behavior into a function, and moves all of the message reaction behavior into one file.

I've also made a function for handling Promise errors, which we can use to redirect our errors into the #general-errors channel that we created for this purpose.