dosebotredux / DosebotRedux

The Unlicense
32 stars 8 forks source link

Update customs.json with latest PW substance api data and hook bussiness logic accordingly #10

Closed nugasescuserbun closed 2 years ago

nugasescuserbun commented 2 years ago

Q: WHY ARE YOU DOING THIS?

A: Because for every info command, we query a subset of this mostly static data from PW substance API, when instead we can store the data locally and only regularly update the list from PW substance API. The main advantage to having this stored locally is that we can do advanced search over them, besides existing case insensitive search, we can do fuzzy searching, like showing suggestions for typos. This PR also fixes the '-' bug and PW substance api aliasing issues.

// Details

This PR updates includes/customs.json with the latest PW substance api information, with the following exceptions:

The existing substances from custom.json have been prioritized over their equivalent entries in the PW subtance api DB. These are: ayahuasca, datura, salvia and lsa. A subsequent PR should be placed with merge of information.

The following substances have not been added from the PW substance api DB: Diazepam, DOC, Ethylphenidate, Methamphetamine, MiPT, NBx. Another subsequent PR will add them.

Note: to maintain backwards compatibility for the case insensitive search but with local support, i had to also modify some logic.

nugasescuserbun commented 2 years ago

/label DO NOT MERGE

wjlafrance commented 2 years ago

Looking great so far. I see you're flagged for do not merge, let me know when you're ready for final review + merge!

nugasescuserbun commented 2 years ago

Added some tests, decided to mock instead of rewrite to pass dependencies so info.run could actually be testable without mocking too much. I think it's final for final review.

wjlafrance commented 2 years ago

Awesome, thank you for these fixes!