Initial commit

This commit is contained in:
Slavi Pantaleev
2024-09-12 13:44:06 +03:00
commit 946aa9d9e9
220 changed files with 26033 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
use mxlink::MessageResponseType;
use crate::{entity::MessageContext, strings, Bot};
pub async fn handle_get<T>(
bot: &Bot,
message_context: &MessageContext,
value: &Option<T>,
) -> anyhow::Result<()>
where
T: std::fmt::Display,
{
match value {
Some(value) => {
bot.messaging()
.send_text_markdown_no_fail(
message_context.room(),
strings::cfg::value_currently_set_to(value),
MessageResponseType::Reply(message_context.thread_info().root_event_id.clone()),
)
.await;
}
None => {
bot.messaging()
.send_text_markdown_no_fail(
message_context.room(),
strings::cfg::value_currently_unset(),
MessageResponseType::Reply(message_context.thread_info().root_event_id.clone()),
)
.await;
}
}
Ok(())
}

View File

@@ -0,0 +1 @@
pub(super) mod generic_setting;