Commit Graph

339 Commits

Author SHA1 Message Date
projectmoon 125f3d0cee Fix drone yml to produce docker images again. 2021-09-06 23:58:05 +00:00
projectmoon a4c3d34a97 Version 0.13.1 2021-09-06 22:21:24 +00:00
projectmoon 86fbb05e54 Run Drone CI on tags 2021-09-06 22:18:06 +00:00
projectmoon 661a943672 Readme Updates (#91)
Add contributing information.

Add support/community section.

Add matrix room badge
Co-Authored-By: projectmoon <projectmoon@noreply.git.agnos.is>
Co-Committed-By: projectmoon <projectmoon@noreply.git.agnos.is>
2021-09-06 22:15:20 +00:00
projectmoon d65715dee6 Remove example room ID from tonic_client 2021-09-05 20:38:45 +00:00
projectmoon 55a3bfb861 Update readme for crates.io installation. 2021-09-05 20:38:09 +00:00
projectmoon 0050810182 Fix dicebot readme link 2021-09-05 20:22:42 +00:00
projectmoon 3ba546d4a4 Add metadata to rpc package. 2021-09-05 20:14:56 +00:00
projectmoon ffded7b572 Add metadata to rpc package. 2021-09-05 20:14:13 +00:00
projectmoon cf93d14913 Version 0.13.0 2021-09-05 19:08:27 +00:00
projectmoon cf6dd96b34 Update sqlx and refinery to newer versions (#88)
For some reason, also required rewriting database tests to deal with
tempfile deleting files after scope drop. This never used to occur,
but now it does! So now the unit tests are in a closure where the temp
file is dropped at the end of the test. Really should just use sqlx
migrations, then we can get an in-memory database.

Co-authored-by: projectmoon <projectmoon@agnos.is>
Reviewed-on: projectmoon/tenebrous-dicebot#88
Co-Authored-By: projectmoon <projectmoon@noreply.git.agnos.is>
Co-Committed-By: projectmoon <projectmoon@noreply.git.agnos.is>
2021-09-05 07:56:41 +00:00
projectmoon c8c6f4d6f0 Fix dependency specification for rpc crate in dicebot. 2021-09-04 23:24:52 +00:00
projectmoon 2488429edb Version 0.12.0 2021-09-04 22:23:36 +00:00
projectmoon f68d5ffcc1 Update to versioned matrix SDK. 2021-09-04 21:37:49 +00:00
projectmoon 473e899275 Merge branch 'kg333-master'
Merge PR #43 from github to fix docker build.
2021-09-03 09:33:02 +00:00
projectmoon 1f03837bfe Merge branch 'master' of https://github.com/kg333/matrix-dicebot into kg333-master 2021-09-03 09:32:48 +00:00
projectmoon 0059e3d133 Revert "Initial prototype of web UI and web API."
This reverts commit cab856241d.
2021-09-03 09:29:52 +00:00
matthew 915b82d0aa Updating GPG key server; sks-keyservers.net is offline permanently 2021-08-28 00:12:12 +00:00
projectmoon cab856241d Initial prototype of web UI and web API.
This commit shuffles the entire repository around into multiple crates, bringing with it an in-progress web UI and web AI. It was merged prematurely to allow for dependency upgrades of the matrix SDK.

The build should still only produce the dicebot image.
Co-Authored-By: projectmoon <projectmoon@noreply.git.agnos.is>
Co-Committed-By: projectmoon <projectmoon@noreply.git.agnos.is>
2021-07-15 15:04:50 +00:00
projectmoon 764426382a Convert project to workspace with Tonic for gRPC. (#84)
Convert project to workspace with Tonic for gRPC.

This commit adds an RPC service to the dicebot, allowing external
applications to control it. The project was converted to a cargo
workspace to house the protobuf definitions in a common crate
(tenebrous-rpc), so that clients and servers can make use of these
protobuf definitions.
Co-Authored-By: projectmoon <projectmoon@noreply.git.agnos.is>
Co-Committed-By: projectmoon <projectmoon@noreply.git.agnos.is>
2021-06-02 21:09:58 +00:00
projectmoon b4321721c4 Minor documentation update. 2021-05-30 22:53:56 +00:00
projectmoon 494d28486e Remove Box<dyn Command> conversion impls for map in macro. 2021-05-30 22:49:28 +00:00
projectmoon b7393c1907 Use active room in relevant commands. 2021-05-30 14:19:13 +00:00
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 53339282e0 Actually set room when running SetRoomCommand (#79)
Also sort rooms in get_rooms_for_user for consistency.
Co-Authored-By: projectmoon <projectmoon@noreply.git.agnos.is>
Co-Committed-By: projectmoon <projectmoon@noreply.git.agnos.is>
2021-05-29 20:26:20 +00:00
projectmoon 7050cf037a Remove return statements in Fuseable impl for room search. 2021-05-29 14:49:24 +00:00
projectmoon 0c0ddafd03 Search for rooms closure as a separate variable. 2021-05-28 21:19:26 +00:00
projectmoon 7f0bdc1e82 Unit test for search_rooms 2021-05-28 21:13:19 +00:00
projectmoon 0ca7ad4db0 Minor fix to command logging. 2021-05-28 15:08:00 +00:00
projectmoon 59be127430 Implement set room command; common code for list and set rooms.
Adds fuzzy room search that can also set by exact ID, and refactors
the code to get room list for user into a common function and struct
for use by both commands.
2021-05-28 15:08:00 +00:00
projectmoon e9c0a184bd Show room list with preformatted text. 2021-05-27 20:47:54 +00:00
projectmoon 589d0e0dbf From<String> for ListRoomsCommand 2021-05-27 15:56:15 +00:00
projectmoon 892ccf73e3 Basic list rooms command. Needs formatting. 2021-05-27 15:52:16 +00:00
projectmoon 896acee5ba Avoid cloned command input with From<String> instead of From<&str>. 2021-05-27 15:50:43 +00:00
projectmoon d70df44d2a Remove MIT notice from bot event handlers 2021-05-26 22:40:15 +00:00
projectmoon 5f15e62c6d Remove 'project' from intial informational text in license. 2021-05-26 22:39:09 +00:00
projectmoon ed3b582aad Matrix SDK isn't MIT anymore. 2021-05-26 22:35:12 +00:00
projectmoon 49db0062a3 Various improvements to bot responses.
- Do not display username pill with quoted HTML replies.
 - Do not attempt to create matrix.to link in plain text replies.
 - Move plain text formatting responsibility outside of matrix
   send_message function.
2021-05-26 22:20:53 +00:00
projectmoon 4ae871224a Remove ExecutionError, as it is unnecessary. 2021-05-26 21:25:32 +00:00
projectmoon 1ebd13e912 Change execution_allowed to a match for shorter reading. 2021-05-26 21:12:21 +00:00
projectmoon 8f5b6f0636 Replace db query with simple in-memory check of if account already exists. 2021-05-26 21:04:53 +00:00
projectmoon 5b3d174edc Separate registering and linking accounts.
Can register an account with the bot to manage variables and stuff in
private room, and then separately "link" it with a password, which
makes it available to anything using the bot API (aka web app). Can
also unlink and unregister. Check command no longer validates
password. It just checks and reports your account status.
2021-05-26 15:28:59 +00:00
projectmoon 495df13fe6 Do not automatically create accounts; use enum to show this instead.
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 de92fc8488 Remove nested <p> tags in error messages. 2021-05-26 07:06:00 +00:00
projectmoon b05129ad9f Localize all command parsing code into trait impls.
This cleans up the command parser a lot, as all of the one or two line
functions and associated imports have been removed. Unfortunately it
does make the command files larger, as two trait impls are required:
one for converting to Box<dyn Command>, and one for converting from
&str to the command type.

Fixes #66.
2021-05-25 23:55:50 +00:00
projectmoon 5d002e5063 Add ability to store user active room, with skeleton accounts.
- 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 849a1b6a14 Remove most of Room DB API 2021-05-24 22:25:20 +00:00
projectmoon 97be5d5ccb Add migration to remove room state management tables. 2021-05-24 22:10:41 +00:00
projectmoon 395753e8a9 Remove room state mgmt; let matrix SDK do it on-demand instead.
Fixes #71.

Fixes #20.
2021-05-24 21:45:51 +00:00
projectmoon df0248d99a More useful account registration message. 2021-05-23 13:58:58 +00:00