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

Highlights allow duplicate values #141

Closed debashisbiswas closed 4 years ago

debashisbiswas commented 4 years ago

Please Describe Your Issue When the user adds highlights, it is added without checking if the phrase already exists. Then, when checking for a match, the whole highlight list is checked, so if there are duplicates, the user gets multiple private messages from Horace notifying them about the same highlight.

How to Reproduce

  1. use command !highlights add testphrase
  2. use command !highlights add testphrase again, with the same phrase as step 1
  3. type !highlights list and see that the phrase is listed twice
  4. type the phrase in the chat, and Horace sends two private messages as the match is found twice

Expected behavior Horace should stop you from adding duplicate highlight items, letting you know when he did not add your item.

Dendrobyte commented 4 years ago

This has actually been patched. The reason why it's currently a bug is because Horace hasn't been updated with the full fix (yet) 👍

Currently my PR is still open since I was working on the Hackathon bot for KOA and have some use cases to add to said PR, i.e. words at the start or end of message and punctuation, and will be wrapped up this weekend. Relevant pr is #130