Commit Graph

16 Commits

Author SHA1 Message Date
projectmoon b894fb83db Update binary entrypoint crate imports after rename. 2021-05-14 22:25:09 +00:00
projectmoon 9ab65b8943 Update env_logger, rand, phf, itertools to newer semvers.
continuous-integration/drone/push Build is passing Details
2021-02-09 21:56:13 +00:00
projectmoon a53ce85f38 Add db migration support, change variables schema.
This is a bit of a large commit that adds basic database migration
support. It also alters the way user variables are stored in a way
requiring manual migration of existing data. The first automated
migration adds variable count in a new place.
2020-10-30 21:53:22 +00:00
projectmoon 6b7acbe520 Open trees for rooms and variables, but not yet use them. 2020-10-18 21:01:52 +00:00
projectmoon 3c2a37c0f7 Make command execution async. 2020-10-18 20:37:02 +00:00
projectmoon 9268314421 Remove actix, move state to RwLock. Update dependencies. 2020-10-18 20:37:02 +00:00
projectmoon 6cdc465a2e Add database and storage of user variables.
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.
2020-10-16 13:18:27 +00:00
projectmoon 514ac84e73 Encapsulate config with Arc. Further bot code cleanup.
Only expose config settings via methods on the Config struct. This
allows default value handling to live entirely inside the config code,
solves various borrowing issues with the "create default bot config
value" solution, and allows us to avoid cloning the bot config values.
The downside is that the config must now be in an Arc since its
ownership is shared in multiple places and the matrix SDK requires
thread-safe types (perhaps in the future we re-compose traits and use
Rc for config instead).

This commit also further cleans up and splits up the bot code for the
matrix connection, notably making the main message event handler
smaller by splitting out the "should we process the message" checks
into a separate function.
2020-10-03 20:45:14 +00:00
projectmoon 938107feae Implement Actix for state, refactor bot code.
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.
2020-10-03 20:45:14 +00:00
projectmoon 6d49c9e16c Fall back to 15 minutes if oldest message age not specified.
This makes the oldest message age setting optional, in additon to the
entire bot config (for now). If the oldest message age is not
specified (or if the entire bot config is missing), it will default to
15 minutes.
2020-09-27 09:44:59 +00:00
projectmoon fabda911fd Ignore messages that are too old. 2020-09-27 09:44:59 +00:00
projectmoon 54a3cc0880 Add basic logging to the dice bot. 2020-08-28 00:13:04 +00:00
jeff 6572e1d04e Port dice bot to use matrix-rust-sdk.
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!
2020-08-26 23:53:30 +00:00
jeff a62727070a Update Cargo files for fork. 2020-08-23 21:24:04 +00:00
Taylor C. Richberger 6cb88a566c get everything working and slightly documented 2020-04-21 22:30:00 -06:00
Taylor C. Richberger 59cb407eae Add dicebot-roll dice expression parser 2020-04-19 16:07:33 -06:00
Renamed from src/main.rs (Browse further)