Commit Graph

348 Commits

Author SHA1 Message Date
projectmoon 16eb87e50f Convert command execution to use results. 2021-01-30 14:28:14 +00:00
projectmoon 1b0003ff1b Upgrade to Matrix SDK latest (Store Rewrite) and Tokio 1.0
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. 2021-01-04 21:12:55 +00:00
projectmoon 297a8454f6 Avoid cloning when counting successes. 2020-12-18 14:16:22 +00:00
projectmoon c9c80b974c Tests for dice pool formatting. 2020-12-17 21:14:43 +00:00
projectmoon eb42704380 Switch to into_iter instead of a non-consuming iterator. 2020-12-17 21:06:43 +00:00
projectmoon f355fad06b Rename some variables for consistency.
Fixes #50.
2020-12-17 20:59:29 +00:00
projectmoon 23cf9e6ba4 Show all rolls if we are below the max amount shown (15 dice). 2020-12-17 20:54:01 +00:00
projectmoon aa28d8bec7 Actually add call of cthulhu documentation to the readme. 2020-11-30 20:32:11 +00:00
projectmoon 62203edce8 Update readme for Call of Cthulhu, roadmap, and other stuff. 2020-11-30 20:31:04 +00:00
projectmoon e177da9c25 Centralize record_room_information function. 2020-11-30 19:53:26 +00:00
projectmoon a65084e04a Unit test for updating room info data. 2020-11-29 21:33:46 +00:00
projectmoon 979dc8ea34 Clearer test name for clearing room info. 2020-11-29 21:29:35 +00:00
projectmoon 0b2246cbd5 Unit tests for inserting and loading room info from db. 2020-11-29 21:29:13 +00:00
projectmoon 7e1abab66d Resync command now uses record_room_information. 2020-11-29 21:18:41 +00:00
projectmoon 569ba4f2e0 Carry full room instance in context instead of just room id. 2020-11-29 21:03:45 +00:00
projectmoon 118e4b00c7 Store room info when joining a room. 2020-11-29 17:06:04 +00:00
projectmoon c8c38ac1d4 Avoid nested map when retrieving room info from db. 2020-11-29 16:55:23 +00:00
projectmoon 91cfc52e5b Change record_users_in_room to record_room_information. 2020-11-29 14:02:40 +00:00
projectmoon 224f8cd0f1 Functions for storing RoomInfo in db. Refactor bot joins room event.
Add get/insert functions for RoomInfo in the rooms db.

Move 'bot joins room' code to single method, so we can also record a
RoomInfo struct into the database.
2020-11-29 14:00:05 +00:00
projectmoon 68db038336 Properly avoid allocation for our_username in resync command. 2020-11-23 19:54:20 +00:00
projectmoon 18352c8c19 Filter out our username when resyncing (with an allocation). 2020-11-22 22:13:11 +00:00
projectmoon dda0d74f45 Implement resync command without filtering ourselves out. 2020-11-22 21:30:24 +00:00
projectmoon f46b914239 Add matrix client to context. 2020-11-22 20:52:44 +00:00
projectmoon f352c90b6b Return error on unrecognized commands. 2020-11-12 21:05:14 +00:00
projectmoon e251294b5f Only execute lines with commands.
Fixes #45 and #46.
2020-11-12 20:22:09 +00:00
projectmoon 0e04e67f6e Log debug instead of trace for timestamp index inserts. 2020-11-10 20:37:14 +00:00
projectmoon 551f21a49a Fix minor typo in rooms db code. 2020-11-10 20:22:26 +00:00
projectmoon 9ed2a81dd3 Record all users in room when joining. 2020-11-10 20:18:00 +00:00
projectmoon 0939feee84 Placeholder to record all user info when joining room 2020-11-09 21:17:03 +00:00
projectmoon 9349dd5f00 Add event processing check to received messages.
Also rename the existing `should_process` function to be more clear,
given presence of another similarly named function:
should_process_message.
2020-11-09 21:16:20 +00:00
projectmoon 74d0b88e80 Add should process check to room member event 2020-11-09 21:16:07 +00:00
projectmoon fb24090952 Keep seen events in database, don't process already-seen events.
Adds a new function `should_process` to rooms impl that determines if
calling could should proceed with processing an event ID. Event IDs
are recorded (along with room ID) as a key pointing to the
system-local timestamp of when the event was received. If the key was
not originally present, we instruct calling code to process the event.

Events are also asychronously recorded by timestamp using a sled event
watcher that listens to inserts in the main tree (described above).
This secondary tree will allow easy cleanup of old events in the
future.
2020-11-09 21:16:07 +00:00
projectmoon d7aaed9e00 Implement room clearing, log to info for member updates. 2020-11-08 21:47:01 +00:00
projectmoon b5c78bcee5 Remove userandroom struct from rooms db 2020-11-08 21:47:01 +00:00
projectmoon 51ba3e3f42 Record user join/leaves in rooms. Move event emitter to its own file. 2020-11-08 21:47:01 +00:00
projectmoon 8e2f34819e Half implemented room state management foundations. 2020-11-08 21:47:01 +00:00
projectmoon 5ce79a3c05 Ignore emacs temp files. 2020-11-08 21:44:37 +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 09278a80b5 Disable docker image building on GitHub. 2020-11-06 09:02:59 +00:00
projectmoon 0d63f7ebcb Fix docker registry domain in drone. 2020-11-06 08:24:30 +00:00
projectmoon d2a4d76ab2 Revert "Change repository name for docker image."
This reverts commit ff34a93e40.
2020-11-06 08:23:52 +00:00
projectmoon ff34a93e40 Change repository name for docker image. 2020-11-05 23:32:22 +00:00
projectmoon b3c258e279 Attempt to add docker image build to Drone. 2020-11-05 23:22:26 +00:00
projectmoon fcec37afb2 Fix typo about config file in readme. 2020-11-05 23:04:03 +00:00
projectmoon 472f02d153 Execute commands even when surrounded by weird whitespace. 2020-11-05 23:03:22 +00:00
projectmoon 3154f36dca Add build badge 2020-11-05 21:08:17 +00:00
projectmoon bc89088dd1 Fix GitHub link in readme. 2020-11-05 20:48:09 +00:00
projectmoon 53840bff9f Add CoC mention to the readme 2020-11-05 20:39:58 +00:00
projectmoon d456320e66 Update readme for repo mirroring. 2020-11-05 19:56:25 +00:00