mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Temporary remove examples/ because of strange errors
This commit is contained in:
parent
dedc861523
commit
510e5d8630
3 changed files with 0 additions and 63 deletions
|
@ -1,16 +0,0 @@
|
|||
[package]
|
||||
name = "examples"
|
||||
version = "0.0.0"
|
||||
publish = false
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
teloxide = { path = "../" }
|
||||
tokio = "0.2.6"
|
||||
pretty_env_logger = "0.3.1"
|
||||
futures = "0.3.1"
|
||||
log = "0.4.8"
|
||||
|
||||
[[example]]
|
||||
name = "ping_bot"
|
||||
path = "ping_bot.rs"
|
|
@ -1,9 +0,0 @@
|
|||
# Examples of how to use Teloxide.
|
||||
|
||||
All examples can be executed with:
|
||||
|
||||
```
|
||||
RUST_LOG=info cargo run --example $name
|
||||
```
|
||||
|
||||
If you've got an example you'd like to see here, please feel free to open an issue. Otherwise if you've got an example you'd like to add, please feel free to make a PR!
|
|
@ -1,38 +0,0 @@
|
|||
use futures::stream::StreamExt;
|
||||
use teloxide::{
|
||||
dispatching::{
|
||||
chat::Dispatcher, update_listeners::polling_default, SessionState,
|
||||
},
|
||||
requests::Request,
|
||||
Bot,
|
||||
};
|
||||
use teloxide::dispatching::chat::{ChatUpdate, ChatUpdateKind};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
pretty_env_logger::init();
|
||||
|
||||
let bot = &Bot::new("1061598315:AAErEDodTsrqD3UxA_EvFyEfXbKA6DT25G0");
|
||||
let mut updater = Box::pin(polling_default(bot));
|
||||
let handler = |s, upd: ChatUpdate| async move {
|
||||
match upd.kind {
|
||||
ChatUpdateKind::Message(m) => {
|
||||
let msg = bot.send_message(m.chat.id, "pong");
|
||||
msg.send().await.unwrap();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
SessionState::Continue(s)
|
||||
};
|
||||
let mut dp = Dispatcher::<'_, (), _>::new(handler);
|
||||
log::info!("Starting the message handler.");
|
||||
loop {
|
||||
let u = updater.next().await.unwrap();
|
||||
match u {
|
||||
Err(e) => log::error!("{}", e),
|
||||
Ok(u) => {
|
||||
let _ = dp.dispatch(u).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue