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,29 @@
use mxlink::MessageResponseType;
use crate::{
entity::{MessageContext, MessagePayload},
Bot,
};
pub mod agent;
pub mod text_to_speech;
pub async fn get_text_body_or_complain<'a>(
bot: &Bot,
message_context: &'a MessageContext,
) -> Option<&'a str> {
match &message_context.payload() {
MessagePayload::Text(text_message_content) => Some(&text_message_content.body),
_ => {
bot.messaging()
.send_text_markdown_no_fail(
message_context.room(),
"This command only works with text messages.".to_owned(),
MessageResponseType::InThread(message_context.thread_info().clone()),
)
.await;
None
}
}
}