From ad3660cffaa30854f5d592e3db297a70cd780762 Mon Sep 17 00:00:00 2001 From: Suya1671 Date: Mon, 23 Jun 2025 17:40:52 +0200 Subject: [PATCH] feat(commands): add explanation command --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/commands/mod.rs | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 281f808..5118041 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1281,6 +1281,12 @@ dependencies = [ "serde", ] +[[package]] +name = "indoc" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" + [[package]] name = "ipnet" version = "2.11.0" @@ -2468,6 +2474,7 @@ dependencies = [ "error-stack", "futures", "http-body-util", + "indoc", "libsqlite3-sys", "menv", "oauth2", diff --git a/Cargo.toml b/Cargo.toml index 71c2305..75cf1da 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,6 +47,7 @@ serde_json = "1.0.140" tower-http = { version = "0.6.6", features = ["trace"] } derive_more = { version = "2.0.1", features = ["from"] } futures = "0.3.31" +indoc = "2.0.6" [features] encrypt = ["libsqlite3-sys/bundled-sqlcipher"] diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 6c61105..a2f1fee 100755 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -36,6 +36,8 @@ enum Command { Triggers(Trigger), #[clap(subcommand)] Aliases(Alias), + /// Provides an explanation of this bot. + Explain, } impl Command { @@ -63,8 +65,25 @@ impl Command { .run(event, state) .await .change_context(CommandError::Aliases), + Self::Explain => Ok(Self::explain()), } } + + fn explain() -> SlackCommandEventResponse { + SlackCommandEventResponse::new( + SlackMessageContent::new().with_text( + indoc::indoc! {r#" + Slack System Bot is a bot that can replace user-sent messages under a "pseudo-account" of a systems member profile using custom display information. + + This is useful for multiple people sharing one body (aka. systems), people who wish to role-play as different characters without having multiple Slack profiles, or anyone else who may want to post messages under a different identity from the same Slack account. + + Due to Slack's limitations, these messages will show up with the [APP] tag - however, they are not apps/bots. You can use message actions to find who the message was sent by. + + If you wish to use the bot yourself, you can start with `/system help` and `/members help`. + "#}.into(), + ), + ).with_response_type(SlackMessageResponseType::InChannel) + } } #[derive(thiserror::Error, displaydoc::Display, Debug)]