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

* handle error when no bannedWords are found in DB #208

Closed catalincodes closed 3 years ago

catalincodes commented 3 years ago

When bannedWords table is empty or not set, the function will throw an error because we were not checking for null. I've added a null-check which displays the problem in the console and immediately returns from the function.

Tested locally and it works as expected. The error doesn't appear and we get the "No banned words found in database" message instead.