diff --git a/src/dispatching/dialogue/dialogue_dispatcher.rs b/src/dispatching/dialogue/dialogue_dispatcher.rs index 2657fd70..4cdb7661 100644 --- a/src/dispatching/dialogue/dialogue_dispatcher.rs +++ b/src/dispatching/dialogue/dialogue_dispatcher.rs @@ -159,7 +159,7 @@ where match this.senders.get(&chat_id) { // An old dialogue Some(tx) => { - if let Err(_) = tx.1.send(cx) { + if tx.1.send(cx).is_err() { panic!( "We are not dropping a receiver or call .close() \ on it", @@ -168,7 +168,7 @@ where } None => { let tx = this.new_tx(); - if let Err(_) = tx.send(cx) { + if tx.send(cx).is_err() { panic!( "We are not dropping a receiver or call .close() \ on it", @@ -281,7 +281,7 @@ mod tests { let tx = tx.clone(); async move { - if let Err(_) = tx.send(update) { + if tx.send(update) { panic!("tx.send(update) failed"); } } diff --git a/src/lib.rs b/src/lib.rs index dd28c3c8..1fb02a2c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -299,22 +299,17 @@ //! that `Dialogue` is a finite automaton with a context type at each state //! (`Dialogue::Start` has `()`, `Dialogue::ReceiveAttempt` has `u8`). //! -//! If you're familiar with [category theory], `Dialogue` is almost a -//! [coproduct], such that: -//! - `X1` is `()` -//! - `X2` is `u8` -//! - `i1` is `Dialogue::Start` -//! - `i2` is `Dialogue::ReceiveAttempt` -//! -//!
-//! -//!
-//! -//! But without the `f`, `f1`, `f2` morphisms and the `Y` object (which we can -//! freely define if we wanted). -//! //! See [examples/dialogue_bot] to see a bit more complicated bot with -//! dialogues. [See more examples] to get into teloxide! +//! dialogues. +//! +//! ## More examples! +//! | Bot | Description | +//! |:---:|:-----------:| +//! | [ping_pong_bot](https://github.com/teloxide/teloxide/tree/master/examples/ping_pong_bot) | Answers "pong" to each incoming message. | +//! | [simple_commands_bot](https://github.com/teloxide/teloxide/tree/master/examples/simple_commands_bot) | Shows how to deal with bot's commands. | +//! | [guess_a_number_bot](https://github.com/teloxide/teloxide/tree/master/examples/guess_a_number_bot) | The "guess a number" game. | +//! | [dialogue_bot](https://github.com/teloxide/teloxide/tree/master/examples/dialogue_bot) | Drive a dialogue with a user using a type-safe finite automaton. | +//! | [admin_bot](https://github.com/teloxide/teloxide/tree/master/examples/admin_bot) | A bot, which can ban, kick, and mute on a command. | //! //! //! # Recommendations