feat(commands): add explanation command

This commit is contained in:
Suya1671 2025-06-23 17:40:52 +02:00
parent 68b58c279a
commit ad3660cffa
No known key found for this signature in database
3 changed files with 27 additions and 0 deletions

7
Cargo.lock generated
View file

@ -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",

View file

@ -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"]

View file

@ -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)]