allow sending stickers via repl tool

This commit is contained in:
B. Petersen
2021-06-10 14:41:14 +02:00
committed by bjoern
parent 8b872b7e6f
commit c616b65ce4

View File

@@ -372,6 +372,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
getlocations [<contact-id>]\n\ getlocations [<contact-id>]\n\
send <text>\n\ send <text>\n\
sendimage <file> [<text>]\n\ sendimage <file> [<text>]\n\
sendsticker <file> [<text>]\n\
sendfile <file> [<text>]\n\ sendfile <file> [<text>]\n\
sendhtml <file for html-part> [<text for plain-part>]\n\ sendhtml <file for html-part> [<text for plain-part>]\n\
videochat\n\ videochat\n\
@@ -865,12 +866,14 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
ensure!(sel_chat.is_some(), "No chat selected."); ensure!(sel_chat.is_some(), "No chat selected.");
chat::send_text_msg(&context, sel_chat.as_ref().unwrap().get_id(), "".into()).await?; chat::send_text_msg(&context, sel_chat.as_ref().unwrap().get_id(), "".into()).await?;
} }
"sendimage" | "sendfile" => { "sendimage" | "sendsticker" | "sendfile" => {
ensure!(sel_chat.is_some(), "No chat selected."); ensure!(sel_chat.is_some(), "No chat selected.");
ensure!(!arg1.is_empty(), "No file given."); ensure!(!arg1.is_empty(), "No file given.");
let mut msg = Message::new(if arg0 == "sendimage" { let mut msg = Message::new(if arg0 == "sendimage" {
Viewtype::Image Viewtype::Image
} else if arg0 == "sendsticker" {
Viewtype::Sticker
} else { } else {
Viewtype::File Viewtype::File
}); });