Killua 1.1.0 (API rewrite to rust, sync -> async, dockerising)
Besides this being super cool, it also fixes a long, LONG issue with the API which would cause vote rewards to not function and the website to not display server count or commands. You can read the details about it in the associated issue #607
This PR, does a bunch of things. It fixes three long standing issues:
- The shop would stop updating after a while for seemingly no reason at random
- The API would stop responding after a day or two of being live without errors
- Sometimes the database times out. This caused the entire bot to be blocked for a bit before.
Here is a graphic to illustrate this:
🛠️ Beyond this, it improves internals a lot. Mainly:
- The API is now written in Rust. This allows it to be insanely type safe for requests needing to match expected format and type. It is also of course much faster (It's rust after all).
- The bot and all associated processes are now Dockerised. This means they are now insanely easy to deploy and migrate.
- A lot of statics are now saved to prometheus. This then allows them to be displayed very nicely on a Grafana dashboard.
- Most of the assets Killua uses (hugs, cards, loot boxes etc) are now served through the API instead of the Discord cdn
- A proxy for zmq is now implemented between the bot and API. This allows A many to many communication between n bot processes and n API processes. This is not needed currently but already future proofs the code should the bot need multithreading.
- A GitHub workflow has been set up to automatically run cargo test, clippy and fmt on pull requests that change API code.
- A bunch of code has been cleaned up to be more readable including the
on_interaction
part of wyr and polls as well as classes. - All database actions now occur asynchronously instead of synchronously. So when one of them fails/times out the entire bot is not blocked. I should have used this from the start, it was painful to rewrite now. This looks something like this:
- user = User(user.id)
+ user = await User.new(user.id)
- user.add_jenny(10)
+ await user.add_jenny(10)
🐛 Bug fixes
- Voting will now always give you a reward
- Some slash command autocomplete would not work
- The shop sometimes failed to update
- Owning card 99 would not be displayed in your book in the restricted slots
- todo create did not work if no custom ID was provided
📦 The following features have been added:
- All image commands can now be applied to an image by replying to the message with the image with the command
- The shop now says when it will update the next time
- Image commands now also accept replied to messages as an argument. If you want to use a command on a specific image that is not the latest in chat, reply to it with the command.
- If there is a tie playing trivia (both players get the right answer) the fastest answer is now the tiebreaker.
User installed commands
User installed commands got a big upgrade this version! The following are now available as user installed commands:
- wyr
- topic
- calc
- 8ball
- img
- All games commands
- All action commands
Unlike last time where I just enabled them to be user installable, a lot of thought has now been put into them to make sure they work as expected ANYWHERE on Discord. You can now hug or play rps with a friend in dms! A fight breaks out in a group chat about a question? Just use 8ball to answer it!
Full Changelog: v0.12.2...v1.1.0