WaniKani Discord Bot (Unaffiliated)

I’m actually level 38, it just hadn’t updated yet :eyes:

It’s #12A89D

image

3 Likes

Awesome! And thank you! :smiley:

1 Like

So, now just a Level 41-50 person to see if doing colors from Pleasant to Reality is a good idea.

1 Like

@latepotato would you be able to help pls?

3 Likes

Bonjour, the colour is #25AAE2

grafik

The forum section is called 天堂 whereas it’s called 天国 on the main WaniKani page :caught_durtling:

5 Likes

Here is what it would like then guys:

\color{#808080} \text{■■■■■ Foggy (Not a WaniKani User)}
\color{#FFFFFF} \text{■■■■■ Pure (Levels 1-3)}
\color{#283890} \text{■■■■■ Pleasant (excludes Levels 1-3 for bot; includes Levels 4-10)}
\color{#9EB83B} \text{■■■■■ Painful (Levels 11-20)}
\color{#3AB54A} \text{■■■■■ Death (Levels 21-30)}
\color{#12A89D} \text{■■■■■ Hell (Levels 31-40)}
\color{#25AAE2} \text{■■■■■ Paradise (Levels 41-50)}
\color{#0E76BD} \text{■■■■■ Reality (Levels 51-59; Level 60 is special)}
\color{#FFFF00} \text{■■■■■ Golden (Level 60)}
\color{#000000} \text{■■■■■ Burned (100% Burned)}

I’d say it looks pretty nice. Any changes any of you would like to these colors? Pleasant to Reality colors are hard set. Perhaps a Level 60 having a lot burned could allow for extra colors? Perhaps each level could be a specific color that is between those main ones set. For now, I think this looks good.

1 Like

This looks perfect!

1 Like

For those of you interested, currently the biggest roadblock is talking to WK and storing the data it gives so we don’t spam it with requests for info every time a user runs a command, but also preventing giving a user outdated information.

Currently working on setting it up and considering writing a wrapper for the WK API in Node. The biggest issue of the whole project, of course, is caching, but that’s the issue with anything to do with an API, so it’s whatever. Once we get a system down to handle talking to WK and not spamming it with requests but not handling outdated data, then it’s just sending it in pretty messages on Discord.

Also, for those interested, I’m using MongoDB to handle all database stuff. It’s fast, scalable, simple (it stores it in JSON), and pretty reliable. I haven’t had an issue with it, and with regular backups I see absolutely no reason not to.

3 Likes

Now we just need an official server :sweat_smile:

We have one! It’s just not going to be publicly accessible for a tiny bit longer…

1 Like

Just a thought on how to update data.
Divide every user that register his key in N groups, then update that group data every N hours. A good number for N should be 4, not too much to have obsolete data but not too few to spam WK with requests.
A thing that you may consider as well is diving each group in smaller sets and requesting every user-set every few minutes (calculated dynamically)

1 Like

That’s good. Also, WK seems to be smart enough to know if data has been updated since last checked, so depending on how that works I could check every time data is requested to see if I need to update specific parts of my cache.

1 Like

You could do a mix of all then. Fetch group 1 and check if group 2 is updated. One hour later fetch group 2 (only updated ones) and check if group 3 is updated and so on.

1 Like

Alternatively, I could store alongside the user entry in the database a lastfetch timestamp. If the user runs a command that requests data five minutes after that timestamp, it requests any new data from WK and resets the timestamp. Thus, you are almost 100% guaranteed to have updated data every time because you don’t have to wait for your group to update. And we prevent spamming the API. I don’t think the bot will get thousands of servers with hundreds of requests each, but best to plan like it anyways.

2 Likes

To make a wrapper or not… thoughts?

You should, maybe even publishing it

1 Like

The Discord server is now public! https://discord.gg/ZTPMQ8EAeM

2 Likes

Update

The development for the WaniKani API wrapper for Node.js is going faster than expected, and I was able to import it into the beta version of the bot! I was thus able to create a command that stores your WaniKani API token safely in the database in DMs, and get my own username. There is, of course, a whole list of data available that I could get alongside that, but the username is the easiest to demonstrate it working with. Here is a screenshot:
iEF0SjzZq9WN

4 Likes