continuous-integration/drone/push Build is passingDetails
continuous-integration/drone/pr Build is passingDetails
- Adds migrations for the necessary tables.
- Implements the user variables database functions.
- Adds sqlx metadata for 'offline' use so we can build without a database.
This gives it parity with the other systems: cofd and cthulhu. More
refactoring and a rewrite later as we trend towards more
system-specific implementations.
This commit introduces the Sled embedded key-value store for keeping
track of user variables on a per-room basis. Extensive changes were
made to the command module to separate concerns and also pass the
database "connection" down the line.
- A new "Context" object was created to hold information and state
needed for command execution (namely the database).
- Database is very simple for now, storing only user variables.
Refactoring later for storing more complicated types.
- State actor moved into Actors struct, in preparation for either
more actors, or ripping the whole thing out entirely.
- Other modules are also more properly separated, notably
the config module is entirely self-contained.
Instead of using an Arc Mutex for state management embedded directly
into the bot, utilize actor pattern, with the idea that this will be
much more useful than simply logging a message once in the future.
This also refactors the bot code so that instead of a single run_bot
function, the DiceBot struct now has a run() method attached to it.
This also necessitated changes and cleanup to the dicebot main, which
is for the better anyhow.
The error and config types are also now in their own files, and
implemented for more in-depth use cases.
This gives us many things for free, like automated state management,
no need to declare special API structs and use HTTP requests directly,
and most importantly: ENCRYPTION!