Fix the tests

This commit is contained in:
Temirkhan Myrzamadi 2020-02-14 14:41:03 +06:00
parent 0b05558aa8
commit 7d142f1f06
2 changed files with 40 additions and 17 deletions

View file

@ -25,4 +25,9 @@ pin-project = "0.4.6"
serde_with_macros = "1.0.1"
either = "1.5.3"
teloxide-macros = { path = "teloxide-macros" }
teloxide-macros = { path = "teloxide-macros" }
[dev-dependencies]
smart-default = "0.6.0"
rand = "0.7.3"
pretty_env_logger = "0.4.0"

View file

@ -24,24 +24,24 @@
//! message:
//!
//! ([Full](https://github.com/teloxide/teloxide/blob/dev/examples/ping_pong_bot/src/main.rs))
//! ```rust
//! ```rust,no_run
//! use teloxide::prelude::*;
//!
//! #[tokio::main]
//! async fn main() {
//! teloxide::enable_logging!();
//! log::info!("Starting the ping-pong bot!");
//! # #[tokio::main]
//! # async fn main() {
//! teloxide::enable_logging!();
//! log::info!("Starting the ping-pong bot!");
//!
//! let bot = Bot::from_env();
//! let bot = Bot::from_env();
//!
//! Dispatcher::<RequestError>::new(bot)
//! .message_handler(&|ctx: DispatcherHandlerCtx<Message>| async move {
//! ctx.answer("pong").send().await?;
//! Ok(())
//! })
//! .dispatch()
//! .await;
//! }
//! Dispatcher::<RequestError>::new(bot)
//! .message_handler(&|ctx: DispatcherHandlerCtx<Message>| async move {
//! ctx.answer("pong").send().await?;
//! Ok(())
//! })
//! .dispatch()
//! .await;
//! # }
//! ```
//!
//! ## Commands
@ -50,7 +50,9 @@
//! [0; 1) on `/generate`, and shows the usage guide on `/help`:
//!
//! ([Full](https://github.com/teloxide/teloxide/blob/dev/examples/simple_commands_bot/src/main.rs))
//! ```rust
//! ```rust,no_run
//! # use teloxide::{prelude::*, utils::command::BotCommand};
//! # use rand::{thread_rng, Rng};
//! // Imports are omitted...
//!
//! #[derive(BotCommand)]
@ -103,6 +105,15 @@
//! #[tokio::main]
//! async fn main() {
//! // Setup is omitted...
//! # teloxide::enable_logging!();
//! # log::info!("Starting simple_commands_bot!");
//! #
//! # let bot = Bot::from_env();
//! #
//! # Dispatcher::<RequestError>::new(bot)
//! # .message_handler(&handle_command)
//! # .dispatch()
//! # .await;
//! }
//! ```
//!
@ -111,7 +122,11 @@
//! You must guess a number from 1 to 10 (inclusively):
//!
//! ([Full](https://github.com/teloxide/teloxide/blob/dev/examples/guess_a_number_bot/src/main.rs))
//! ```rust
//! ```rust,no_run
//! # #[macro_use]
//! # extern crate smart_default;
//! # use teloxide::prelude::*;
//! # use rand::{thread_rng, Rng};
//! // Imports are omitted...
//!
//! #[derive(SmartDefault)]
@ -178,6 +193,9 @@
//!
//! #[tokio::main]
//! async fn main() {
//! # teloxide::enable_logging!();
//! # log::info!("Starting guess_a_number_bot!");
//! # let bot = Bot::from_env();
//! // Setup is omitted...
//!
//! Dispatcher::new(bot)