diff --git a/Cargo.toml b/Cargo.toml index 469a034..bb51a5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,4 +21,5 @@ hyper-tls = { version = "0.4", optional = true } futures = "0.3" hyper-rustls = { version = "0.19", optional = true } -rusqlite = "0.24.1" \ No newline at end of file +rusqlite = "0.24.1" +html-escape = "0.2" diff --git a/src/commands.rs b/src/commands.rs index d731025..0a5f387 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -2,19 +2,24 @@ use crate::db; use telegram_bot::prelude::*; use telegram_bot::{Api, Error, Message, MessageKind, ParseMode, UpdateKind}; use tokio::time::delay_for; +use html_escape::encode_text; pub(crate) async fn here(api: Api, message: Message) -> Result<(), Error> { let members: Vec = db::get_members(&message.chat.id()).unwrap(); - let mut msg = "I summon you, ".to_string(); + for u in &members { + println!("Found user {:?}", u); + } + let mut msg = "I summon you, ".to_string(); for user in members { let mention = match user.username { Some(username) => format!("@{}", username), - _ => format!("[{}](tg://user?id={})", user.first_name, user.id), + _ => format!("{}", encode_text(&user.id.to_string()), encode_text(&user.first_name)), }; msg = format!("{} {}", msg, mention); } + println!("Message: {:?}", msg); - api.send(message.text_reply(msg).parse_mode(ParseMode::MarkdownV2)) + api.send(message.text_reply(msg).parse_mode(ParseMode::Html)) .await?; //api.send(message.chat.text("Text to message chat")).await?; //api.send(message.from.text("Private text")).await?;