mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-23 01:54:22 +00:00
Create inline bot skeleton
This commit is contained in:
parent
47de75f702
commit
2c2a7ffc07
1 changed files with 20 additions and 2 deletions
22
src/main.rs
22
src/main.rs
|
@ -1,5 +1,23 @@
|
||||||
|
use teloxide::prelude::*;
|
||||||
|
use teloxide::types::*;
|
||||||
|
use log::*;
|
||||||
|
|
||||||
mod data;
|
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<Bot>| 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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue