Added shitty 3rd option

This commit is contained in:
2020-09-08 17:06:36 +02:00
parent 6a93251d81
commit 59f91e72e9

View File

@@ -7,7 +7,7 @@ use telegram_bot::*;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
dotenv().ok(); dotenv().ok();
let token = env::var("TELEGRAM_BOT_TOKEN").expect("TELEGRAM_BOT_TOKEN not set"); let token = env::var("TELEGRAM_BOT_TOKEN").expect("TELEGRAM_BOT_TOKEN not set");
let api = Api::new(token); let api = Api::new(token);
@@ -22,6 +22,7 @@ async fn main() {
if let UpdateKind::InlineQuery(query) = update.kind { if let UpdateKind::InlineQuery(query) = update.kind {
let mut option1 = String::new(); let mut option1 = String::new();
let mut option2 = String::new(); let mut option2 = String::new();
let mut option3 = String::new();
if query.query == "" { if query.query == "" {
api.send(query.answer(vec![])).await.ok(); api.send(query.answer(vec![])).await.ok();
continue; continue;
@@ -37,7 +38,10 @@ async fn main() {
option1.push(letter.to_lowercase().next().unwrap()); option1.push(letter.to_lowercase().next().unwrap());
option2.push(letter.to_uppercase().next().unwrap()); option2.push(letter.to_uppercase().next().unwrap());
} }
option3.push(letter);
option3.push(' ');
} }
option3.pop();
} }
api.send(query.answer(vec![ api.send(query.answer(vec![
@@ -55,6 +59,13 @@ async fn main() {
disable_web_page_preview: false, disable_web_page_preview: false,
} }
).into(), ).into(),
InlineQueryResultArticle::new(
"3", option3.clone(), InputTextMessageContent {
message_text: option3,
parse_mode: None,
disable_web_page_preview: false,
}
).into(),
])).await.ok(); ])).await.ok();
} }
} }