diff --git a/src/main.rs b/src/main.rs index afeeb3c..86997db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,23 @@ +use teloxide::prelude::*; +use teloxide::types::*; +use log::*; + mod data; -fn main() { - println!("Hello, world!"); + +#[tokio::main] +async fn main() { + pretty_env_logger::init(); + info!("patched-porobot is starting..."); + + let bot = Bot::from_env().auto_send(); + + let handler = Update::filter_inline_query().branch(dptree::endpoint(|query: InlineQuery, bot: AutoSend| async move { + let result = InlineQueryResult::Article(InlineQueryResultArticle::new("test", "Test", InputMessageContent::Text(InputMessageContentText::new("Qui รจ dove metterei la mia carta, se solo ne avessi una!")))); + + let response = bot.answer_inline_query(&query.id, vec![result]).await; + respond(()) + })); + + Dispatcher::builder(bot, handler).enable_ctrlc_handler().build().dispatch().await; }