mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-18 15:20:15 +01:00
Quick fixes
This commit is contained in:
parent
e0d0e22ea6
commit
3308014694
4 changed files with 6 additions and 88 deletions
34
README.md
34
README.md
|
@ -93,17 +93,6 @@ async fn main() {
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Click here to run it!</summary>
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/teloxide/teloxide.git
|
|
||||||
cd teloxide/examples/ping_pong_bot
|
|
||||||
TELOXIDE_TOKEN=<Your token here> cargo run
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<kbd>
|
<kbd>
|
||||||
<img src=https://github.com/teloxide/teloxide/raw/master/media/PING_PONG_BOT.png width="600" />
|
<img src=https://github.com/teloxide/teloxide/raw/master/media/PING_PONG_BOT.png width="600" />
|
||||||
|
@ -161,17 +150,6 @@ async fn main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Click here to run it!</summary>
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/teloxide/teloxide.git
|
|
||||||
cd teloxide/examples/simple_commands_bot
|
|
||||||
TELOXIDE_TOKEN=<Your token here> cargo run
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<kbd>
|
<kbd>
|
||||||
<img src=https://github.com/teloxide/teloxide/raw/master/media/SIMPLE_COMMANDS_BOT.png width="500"/>
|
<img src=https://github.com/teloxide/teloxide/raw/master/media/SIMPLE_COMMANDS_BOT.png width="500"/>
|
||||||
|
@ -179,7 +157,6 @@ TELOXIDE_TOKEN=<Your token here> cargo run
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
See? The dispatcher gives us a stream of messages, so we can handle it as we want! Here we use our `.commands::<Command>()` and [`.for_each_concurrent()`](https://docs.rs/futures/0.3.4/futures/stream/trait.StreamExt.html#method.for_each_concurrent), but others are also available:
|
See? The dispatcher gives us a stream of messages, so we can handle it as we want! Here we use our `.commands::<Command>()` and [`.for_each_concurrent()`](https://docs.rs/futures/0.3.4/futures/stream/trait.StreamExt.html#method.for_each_concurrent), but others are also available:
|
||||||
- [`.flatten()`](https://docs.rs/futures/0.3.4/futures/stream/trait.StreamExt.html#method.flatten)
|
- [`.flatten()`](https://docs.rs/futures/0.3.4/futures/stream/trait.StreamExt.html#method.flatten)
|
||||||
- [`.left_stream()`](https://docs.rs/futures/0.3.4/futures/stream/trait.StreamExt.html#method.left_stream)
|
- [`.left_stream()`](https://docs.rs/futures/0.3.4/futures/stream/trait.StreamExt.html#method.left_stream)
|
||||||
|
@ -261,17 +238,6 @@ async fn main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Click here to run it!</summary>
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/teloxide/teloxide.git
|
|
||||||
cd teloxide/examples/guess_a_number_bot
|
|
||||||
TELOXIDE_TOKEN=<Your token here> cargo run
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<kbd>
|
<kbd>
|
||||||
<img src=https://github.com/teloxide/teloxide/raw/master/media/GUESS_A_NUMBER_BOT.png width="600" />
|
<img src=https://github.com/teloxide/teloxide/raw/master/media/GUESS_A_NUMBER_BOT.png width="600" />
|
||||||
|
|
|
@ -5,7 +5,7 @@ use futures::{stream::BoxStream, Stream, StreamExt};
|
||||||
|
|
||||||
/// An extension trait to be used with [`DispatcherHandlerRx`].
|
/// An extension trait to be used with [`DispatcherHandlerRx`].
|
||||||
///
|
///
|
||||||
/// [`DispatcherHandlerRx`]: crate:dispatching::DispatcherHandlerRx
|
/// [`DispatcherHandlerRx`]: crate::dispatching::DispatcherHandlerRx
|
||||||
pub trait DispatcherHandlerRxExt {
|
pub trait DispatcherHandlerRxExt {
|
||||||
/// Extracts only text messages from this stream of arbitrary messages.
|
/// Extracts only text messages from this stream of arbitrary messages.
|
||||||
fn text_messages(
|
fn text_messages(
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! When [`Update`] is received from Telegram, [`Dispatcher`] pushes it into an
|
//! When [`Update`] is received from Telegram, [`Dispatcher`] pushes it into an
|
||||||
//! appropriate handler. That's simple!
|
//! appropriate handler, depending on its kind. That's simple!
|
||||||
//!
|
//!
|
||||||
//! **Note** that handlers must implement [`DispatcherHandler`], which means
|
//! **Note** that handlers must implement [`DispatcherHandler`], which means
|
||||||
//! that:
|
//! that:
|
||||||
|
|
56
src/lib.rs
56
src/lib.rs
|
@ -2,21 +2,7 @@
|
||||||
//! using the [`async`/`.await`] syntax in [Rust]. It handles all the difficult
|
//! using the [`async`/`.await`] syntax in [Rust]. It handles all the difficult
|
||||||
//! stuff so you can focus only on your business logic.
|
//! stuff so you can focus only on your business logic.
|
||||||
//!
|
//!
|
||||||
//! # Features
|
//! See also [our GitHub repository](https://github.com/teloxide/teloxide).
|
||||||
//! - **Type-safe.** teloxide leverages the Rust's type system with two serious
|
|
||||||
//! implications: resistance to human mistakes and tight integration with
|
|
||||||
//! IDEs. Write fast, avoid debugging as much as possible.
|
|
||||||
//!
|
|
||||||
//! - **Flexible API.** teloxide gives you the power of [streams]: you can
|
|
||||||
//! combine [all 30+ patterns] when working with updates from Telegram.
|
|
||||||
//!
|
|
||||||
//! - **Persistency.** By default, teloxide stores all user dialogues in RAM,
|
|
||||||
//! but you can store them somewhere else (for example, in DB) just by
|
|
||||||
//! implementing 2 functions.
|
|
||||||
//!
|
|
||||||
//! - **Convenient dialogues system.** Define a type-safe [finite automaton]
|
|
||||||
//! and transition functions to drive a user dialogue with ease (see [the
|
|
||||||
//! guess-a-number example](#guess-a-number) below).
|
|
||||||
//!
|
//!
|
||||||
//! # Getting started
|
//! # Getting started
|
||||||
//! 1. Create a new bot using [@Botfather] to get a token in the format
|
//! 1. Create a new bot using [@Botfather] to get a token in the format
|
||||||
|
@ -72,17 +58,6 @@
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! <details>
|
|
||||||
//! <summary>Click here to run it!</summary>
|
|
||||||
//!
|
|
||||||
//! ```text
|
|
||||||
//! git clone https://github.com/teloxide/teloxide.git
|
|
||||||
//! cd teloxide/examples/ping_pong_bot
|
|
||||||
//! TELOXIDE_TOKEN=<Your token here> cargo run
|
|
||||||
//! ```
|
|
||||||
//!
|
|
||||||
//! </details>
|
|
||||||
//!
|
|
||||||
//! <div align="center">
|
//! <div align="center">
|
||||||
//! <kbd>
|
//! <kbd>
|
||||||
//! <img src=https://github.com/teloxide/teloxide/raw/master/media/PING_PONG_BOT.png width="600" />
|
//! <img src=https://github.com/teloxide/teloxide/raw/master/media/PING_PONG_BOT.png width="600" />
|
||||||
|
@ -151,17 +126,6 @@
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! <details>
|
|
||||||
//! <summary>Click here to run it!</summary>
|
|
||||||
//!
|
|
||||||
//! ```text
|
|
||||||
//! git clone https://github.com/teloxide/teloxide.git
|
|
||||||
//! cd teloxide/examples/simple_commands_bot
|
|
||||||
//! TELOXIDE_TOKEN=<Your token here> cargo run
|
|
||||||
//! ```
|
|
||||||
//!
|
|
||||||
//! </details>
|
|
||||||
//!
|
|
||||||
//! <div align="center">
|
//! <div align="center">
|
||||||
//! <kbd>
|
//! <kbd>
|
||||||
//! <img src=https://github.com/teloxide/teloxide/raw/master/media/SIMPLE_COMMANDS_BOT.png width="500"/>
|
//! <img src=https://github.com/teloxide/teloxide/raw/master/media/SIMPLE_COMMANDS_BOT.png width="500"/>
|
||||||
|
@ -273,17 +237,6 @@
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! <details>
|
|
||||||
//! <summary>Click here to run it!</summary>
|
|
||||||
//!
|
|
||||||
//! ```text
|
|
||||||
//! git clone https://github.com/teloxide/teloxide.git
|
|
||||||
//! cd teloxide/examples/guess_a_number_bot
|
|
||||||
//! TELOXIDE_TOKEN=<Your token here> cargo run
|
|
||||||
//! ```
|
|
||||||
//!
|
|
||||||
//! </details>
|
|
||||||
//!
|
|
||||||
//! <div align="center">
|
//! <div align="center">
|
||||||
//! <kbd>
|
//! <kbd>
|
||||||
//! <img src=https://github.com/teloxide/teloxide/raw/master/media/GUESS_A_NUMBER_BOT.png width="600" />
|
//! <img src=https://github.com/teloxide/teloxide/raw/master/media/GUESS_A_NUMBER_BOT.png width="600" />
|
||||||
|
@ -301,9 +254,7 @@
|
||||||
//! (`Dialogue::Start` has `()`, `Dialogue::ReceiveAttempt` has `u8`).
|
//! (`Dialogue::Start` has `()`, `Dialogue::ReceiveAttempt` has `u8`).
|
||||||
//!
|
//!
|
||||||
//! See [examples/dialogue_bot] to see a bit more complicated bot with
|
//! See [examples/dialogue_bot] to see a bit more complicated bot with
|
||||||
//! dialogues.
|
//! dialogues. [See all examples](https://github.com/teloxide/teloxide/tree/master/examples).
|
||||||
//!
|
|
||||||
//! # [More examples!](https://github.com/teloxide/teloxide/tree/master/examples)
|
|
||||||
//!
|
//!
|
||||||
//! # Recommendations
|
//! # Recommendations
|
||||||
//!
|
//!
|
||||||
|
@ -347,8 +298,9 @@
|
||||||
//! [category theory]: https://en.wikipedia.org/wiki/Category_theory
|
//! [category theory]: https://en.wikipedia.org/wiki/Category_theory
|
||||||
//! [coproduct]: https://en.wikipedia.org/wiki/Coproduct
|
//! [coproduct]: https://en.wikipedia.org/wiki/Coproduct
|
||||||
|
|
||||||
|
// https://github.com/teloxide/teloxide/raw/master/logo.svg doesn't work in html_logo_url, I don't know why.
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://github.com/teloxide/teloxide/raw/master/logo.svg",
|
html_logo_url = "https://github.com/teloxide/teloxide/raw/master/ICON.png",
|
||||||
html_favicon_url = "https://github.com/teloxide/teloxide/raw/master/ICON.png"
|
html_favicon_url = "https://github.com/teloxide/teloxide/raw/master/ICON.png"
|
||||||
)]
|
)]
|
||||||
#![allow(clippy::match_bool)]
|
#![allow(clippy::match_bool)]
|
||||||
|
|
Loading…
Reference in a new issue