Commit Graph

53 Commits

Author SHA1 Message Date
projectmoon cf9ce63892 Replace application-level database connectivity.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
- Some database methods not yet implemented.
 - Unit tests create temp files that are not cleaned up (but they should be).
2021-05-15 23:45:30 +00:00
projectmoon 6b6e59da2e Initial SQLx implementation (variables). not yet wired up to bot.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
- 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.
2021-05-15 15:27:40 +00:00
projectmoon b1972e2850 Update dependencies.
continuous-integration/drone/push Build is passing Details
2021-05-14 22:53:10 +00:00
projectmoon 9446435843 Version 0.10.0.
continuous-integration/drone/push Build is passing Details
2021-05-14 22:27:57 +00:00
projectmoon b894fb83db Update binary entrypoint crate imports after rename. 2021-05-14 22:25:09 +00:00
projectmoon 8939d6debd Update dependencies.
continuous-integration/drone/push Build is passing Details
2021-05-13 19:48:29 +00:00
projectmoon b62359c172 Update to rust 1.51 with rustup, for zeroconf 0.4 which requires const generics.
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2021-04-20 21:35:12 +00:00
projectmoon 8d1a1a5ca6 Update dependencies. 2021-04-20 21:19:47 +00:00
projectmoon 119321e01a Update dependencies.
continuous-integration/drone/push Build is passing Details
2021-04-02 16:07:15 +00:00
projectmoon ba6a4c9679 Update matrix SDK to latest with Room enum 2.0
continuous-integration/drone/push Build is passing Details
2021-03-22 15:01:49 +00:00
projectmoon 8e4eb574d2 Update to latest matrix SDK and other dependencies.
continuous-integration/drone/push Build is passing Details
2021-03-15 20:10:42 +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 8817cae9da Update dependencies. Should partially address rate limiting.
continuous-integration/drone/push Build is passing Details
2021-02-09 21:27:14 +00:00
projectmoon d42e075c5c Update dependencies.
continuous-integration/drone/push Build is passing Details
2021-02-07 21:58:22 +00:00
projectmoon 7db639f16c Update cargo.lock for 0.9.0 2021-02-07 14:21:21 +00:00
projectmoon 12b7d355d2 Docker image is 'tiny', not 'glibc-tiny'. Update to 0.8.0.
continuous-integration/drone/push Build is passing Details
2021-02-04 18:56:15 +00:00
projectmoon b32b761f82 Update combine and dependencies. 2021-02-03 23:23:15 +00:00
projectmoon 3faca6a2df Update dependencies.
continuous-integration/drone/push Build is passing Details
2021-02-02 20:21:31 +00:00
projectmoon b3c4d8a38c Centralize plain text formatting at point of message sending.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
Instead of relying on all parts of the application to construct both
HTML and plain-text responses, we now construct only HTML responses,
and convert the HTML to plain text right before sending the message to
Matrix.

This is a first iteration, because the plain text has a few extra
newlines than it should, created by use of nested <p> tags.
2021-01-31 14:12:09 +00:00
projectmoon 1b0003ff1b Upgrade to Matrix SDK latest (Store Rewrite) and Tokio 1.0
continuous-integration/drone/push Build is passing Details
This upgrade introduces a handful of breaking changes in the Rust
Matrix SDK.
 - Some types have disappeared and changed name.
 - Some functions are no longer async.
 - Room display name now has a Result type instead of just returning
   the value.
 - Client state store has breaking changes (not really a big deal).

This required introduction of a new type to store room information
that we are interested in on the context struct. This new RoomContext
is required mostly due to unit tests, because it is no longer possible
to instantiate the Room type in the Matrix SDK.
2021-01-30 12:54:47 +00:00
projectmoon a4cdad4936 Update dependencies.
continuous-integration/drone/push Build is passing Details
2021-01-04 21:12:55 +00:00
projectmoon a5dde18899 Update to the latest matrix SDK, and fix the Cargo.toml entry.
By using rev instead of branch, we were somehow stuck on a very old
version of the SDK. The dependency has now been switched to branch
instead of rev, and the SDK updates properly to latest master when
carg update is called.
2020-11-08 21:43:18 +00:00
projectmoon bf4ce24b79 Better public API for user variables, avoid allocations in Context.
The database API for user variables has changed somewhat again, this
time closer to the proper vision. There are now two separate sled
Trees in the Variables struct, one for user-defined variables, and one
for counts. Keys have been changed to be username-first, then room ID.
The signatures of the functions now also use a strongly-typed struct,
UserAndRoom.

As part of this, the Context object now once again avoids allocating
new strings.

Other random changes included here:
 - Remove tempfile crate in favor of sled temporary db config.
 - Add bincode crate in anticipation of future (de)serializing.
2020-11-03 20:31:29 +00:00
projectmoon 9f598541fb Remove variable_count keys missed in manual data migration. 2020-10-30 22:44:19 +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 4033b343e7 Update dependencies. 2020-10-30 20:31:35 +00:00
projectmoon 9268314421 Remove actix, move state to RwLock. Update dependencies. 2020-10-18 20:37:02 +00:00
projectmoon 1ef3b50a6e Update to 0.7.0 2020-10-17 07:01:29 +00:00
projectmoon af2e58351f Resolve variables in dice pools. 2020-10-16 22:20:46 +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 35485cdfc8 Update dependencies. 2020-10-11 21:39:12 +00:00
projectmoon 20e8c3cd67 Remove once_cell 2020-10-11 21:24:56 +00:00
projectmoon 7e44faf693 Dice pool and command parser rewrite to prepare for user variables.
This commit refactors the parsing and rolling for the dice pool system
to prepare for support of user variables. The nom parser was dropped
in favor of the easier-to-understand combine parser in most parts of
the code.

A breaking change was introduced into the dice pool syntax to allow
for proper expressions and variables. The syntax is now
"modifiers:pool-amount", e.g. "n:gnosis+8". The simple single-number
syntax with no modifiers is also still understood.

Dice pool expressions are translated into a Vec of "Amount" objects,
stored by the DicePool struct. They have an operator (+ or -) and
either a number or variable name. When the dice pool is rolled, this
list of Amonuts are is collapsed into a single number that is rolled,
as it was before the refactor.

The following changes were made to the dice rolling code:
 - Store Vec<Amount> on DicePool instead of single number to roll.
 - New struct RolledDicePool to store result of a dice pool roll.
 - Remove Display trait from DicePool, move it over to RolledDicePool.
 - Separate extra dice pool info into DicePoolModifiers.
 - DicePoolModifiers is shared between DicePool and RolledDicePool.
 - Dice parsing and rolling now return standard Result objects.

This commit does NOT enable support of actually using variables. Any
dice pool roll containing a variable will result in an eror.

The command parser was also rewritten to use combine and rely on the
standard Result pattern.
2020-10-11 21:22:12 +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 a5ec5c1e12 Release 0.6.0 2020-09-27 13:04:13 +00:00
projectmoon e391deb278 Update cargo.lock for 0.5.2 2020-09-26 13:49:58 +00:00
projectmoon fafae6175b Update to latest matrix SDK; dynamic libolm; Dockerfile cleanup.
Updates to the latest matrix SDK, which has a new version of olm-sys
(must be dynamically linked at the moment). Also cleans up the
Dockerfile to remove rustup because Void has reached Rust 1.46.0, for
a faster build.
2020-09-25 22:31:11 +00:00
projectmoon 531844fbb7 Implement basic, not-well-formatted help. 2020-08-30 21:54:01 +00:00
projectmoon 8484e9ffde Allow extraneous whitespace at the end of command input. 2020-08-30 21:45:42 +00:00
projectmoon dfa96f51bd Update matrix SDK to latest master. 2020-08-28 21:10:59 +00:00
projectmoon 940e83077a Version 0.4.0: limit display of large dice pools, basic logging. 2020-08-28 00:37:39 +00:00
projectmoon 54a3cc0880 Add basic logging to the dice bot. 2020-08-28 00:13:04 +00:00
jeff 0eb181a7a9 Clean up dependencies and upgrade to 0.3.0 after matrix SDK port. 2020-08-27 00:05:19 +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
projectmoon 2c08eb41ad Implement Chronicles of Darkness dice system, improve error handling.
Adds the Chronicles of Darkness 2E dice system to the bot, and also
somewhat improves the error handling when weird commands are received.
2020-08-23 21:24:04 +00:00
jeff b2b15f9a85 Update dependencies for LibreSSL 3.1 2020-08-23 21:24:04 +00:00
Taylor C. Richberger 13e62e053d flesh out the readme 2020-04-21 22:50:07 -06:00
Taylor C. Richberger 19fc5a6bc9 update Cargo.lock 2020-04-21 22:36:34 -06:00
Taylor C. Richberger a9e1ccbf2e restructure into dice module 2020-04-20 11:19:50 -06:00