Commit Graph

24 Commits

Author SHA1 Message Date
projectmoon 3d2eb14cd3 Change room in context to origin_room, add active_room.
The context now knows about origin room (the room where the command
was executed), and the "active room," which is the room that the user
wants the command to apply to. If no active room is defined, then the
origin room acts as the active room. In a public room with the bot,
the active room is also the same as the origin room.
2021-05-30 14:18:56 +00:00
projectmoon 495df13fe6 Do not automatically create accounts; use enum to show this instead.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
Instead of automatically creating a user account entry for any user
executing a command, we use an Account enum which covers both
registered and "transient" unregistered users. If a user registers,
the context has the actual user instance available, with state and
everything. If a user is unregistered, then the account is considered
transient for the request, with only the username available.
2021-05-26 14:20:18 +00:00
projectmoon 5d002e5063 Add ability to store user active room, with skeleton accounts.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
- Adds a user_state table, currently only with active_room.
 - A user must have an account to take advantage of state.
 - Now, all users will get an 'account' even if they don't explicitly register.
 - Bonus: converts user queries to compile-time checked macros.

To support these automatically created "accounts," the accounts table
now also has an account_status column, indicating if the user is
registered or not (or pending activation--future use).

The User model has been updated with extra properties from the state,
and the user is now carrried in the Context during command execution.
A user is ensured to be created before executing the command.
2021-05-25 22:29:01 +00:00
projectmoon 34ee2c6e5d Consider command execution secure when proper conditions are met.
continuous-integration/drone/push Build is failing Details
- If the room is end-to-end encrypted.
 - If only the sending user and the bot are present in the room.

This lays groundwork for sensitive commands like registering a user
account with the bot.
2021-05-21 22:28:45 +00:00
projectmoon 5643677627 Consolidate dice and variable parsers under parser module.
continuous-integration/drone/push Build is passing Details
2021-05-21 14:44:03 +00:00
projectmoon 3d5cda39c8 Consolidate dice module into logic module. 2021-05-21 14:26:58 +00:00
projectmoon 4de273db4a Remove sled code; promote sql to top level 2021-05-21 14:05:25 +00:00
projectmoon e539dcac1f Move migrations to sqlite directory. Remove in-memory temp db until refinery supports sqlx.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 14:50:49 +00:00
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 c4e0393d99 Update variables on advancement rolls.
continuous-integration/drone/push Build is passing Details
2021-05-13 21:16:41 +00:00
projectmoon d67328ac6b Cthulhu dice only take one amount now 2021-05-13 20:24:17 +00:00
projectmoon 8939d6debd Update dependencies.
continuous-integration/drone/push Build is passing Details
2021-05-13 19:48:29 +00:00
projectmoon e5431a587d Support complex expressions on CoC advancement rolls. (#55)
continuous-integration/drone/push Build is passing Details
Also remove todo, update some CoC command descriptions.

Fixes #54.
Co-Authored-By: projectmoon <projectmoon@noreply.git.agnos.is>
Co-Committed-By: projectmoon <projectmoon@noreply.git.agnos.is>
2021-03-18 20:54:49 +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 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 569ba4f2e0 Carry full room instance in context instead of just room id.
continuous-integration/drone/push Build is passing Details
2020-11-29 21:03:45 +00:00
projectmoon f46b914239 Add matrix client to context. 2020-11-22 20:52:44 +00:00
projectmoon 39e6eb9b46 Implement support for user variables in CoC dice rolling.
Also comes with reorganization of the dice rolling code to centralize
the variable -> dice amount logic, and changes the way the results of
those rolls are displayed.
2020-11-04 20:33:30 +00:00
projectmoon a15d3e0bac Fix cthulhu advancement rolls, add remaining dice tests. 2020-11-01 19:29:09 +00:00
projectmoon c55926a005 Support modifiers for cthulhu rolls, and add tests. 2020-10-31 20:51:17 +00:00
projectmoon 08b0e58193 Implement parsing of Cthulhu dice, only basic for now.
Does not understand anything besides single numbers at the moment.
2020-10-31 20:51:17 +00:00
projectmoon c290393ddf Centralize common parsing code.
Needed for further development of different systems that rely on these
kind of expressions, and lays groundwork for future changes.
2020-10-31 20:51:17 +00:00
projectmoon e3b819ecb0 Wire up regular cthulhu roll commmand (not yet parsed). 2020-10-31 20:51:17 +00:00
projectmoon d5034c11dc Basic implementation of CoC dice rolling.
Not hooked up to parser or commands yet.
2020-10-31 20:51:17 +00:00