mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-24 23:57:38 +01:00
Fix the tests
This commit is contained in:
parent
0b05558aa8
commit
7d142f1f06
2 changed files with 40 additions and 17 deletions
|
@ -25,4 +25,9 @@ pin-project = "0.4.6"
|
||||||
serde_with_macros = "1.0.1"
|
serde_with_macros = "1.0.1"
|
||||||
either = "1.5.3"
|
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"
|
||||||
|
|
50
src/lib.rs
50
src/lib.rs
|
@ -24,24 +24,24 @@
|
||||||
//! message:
|
//! message:
|
||||||
//!
|
//!
|
||||||
//! ([Full](https://github.com/teloxide/teloxide/blob/dev/examples/ping_pong_bot/src/main.rs))
|
//! ([Full](https://github.com/teloxide/teloxide/blob/dev/examples/ping_pong_bot/src/main.rs))
|
||||||
//! ```rust
|
//! ```rust,no_run
|
||||||
//! use teloxide::prelude::*;
|
//! use teloxide::prelude::*;
|
||||||
//!
|
//!
|
||||||
//! #[tokio::main]
|
//! # #[tokio::main]
|
||||||
//! async fn main() {
|
//! # async fn main() {
|
||||||
//! teloxide::enable_logging!();
|
//! teloxide::enable_logging!();
|
||||||
//! log::info!("Starting the ping-pong bot!");
|
//! log::info!("Starting the ping-pong bot!");
|
||||||
//!
|
//!
|
||||||
//! let bot = Bot::from_env();
|
//! let bot = Bot::from_env();
|
||||||
//!
|
//!
|
||||||
//! Dispatcher::<RequestError>::new(bot)
|
//! Dispatcher::<RequestError>::new(bot)
|
||||||
//! .message_handler(&|ctx: DispatcherHandlerCtx<Message>| async move {
|
//! .message_handler(&|ctx: DispatcherHandlerCtx<Message>| async move {
|
||||||
//! ctx.answer("pong").send().await?;
|
//! ctx.answer("pong").send().await?;
|
||||||
//! Ok(())
|
//! Ok(())
|
||||||
//! })
|
//! })
|
||||||
//! .dispatch()
|
//! .dispatch()
|
||||||
//! .await;
|
//! .await;
|
||||||
//! }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ## Commands
|
//! ## Commands
|
||||||
|
@ -50,7 +50,9 @@
|
||||||
//! [0; 1) on `/generate`, and shows the usage guide on `/help`:
|
//! [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))
|
//! ([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...
|
//! // Imports are omitted...
|
||||||
//!
|
//!
|
||||||
//! #[derive(BotCommand)]
|
//! #[derive(BotCommand)]
|
||||||
|
@ -103,6 +105,15 @@
|
||||||
//! #[tokio::main]
|
//! #[tokio::main]
|
||||||
//! async fn main() {
|
//! async fn main() {
|
||||||
//! // Setup is omitted...
|
//! // 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):
|
//! 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))
|
//! ([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...
|
//! // Imports are omitted...
|
||||||
//!
|
//!
|
||||||
//! #[derive(SmartDefault)]
|
//! #[derive(SmartDefault)]
|
||||||
|
@ -178,6 +193,9 @@
|
||||||
//!
|
//!
|
||||||
//! #[tokio::main]
|
//! #[tokio::main]
|
||||||
//! async fn main() {
|
//! async fn main() {
|
||||||
|
//! # teloxide::enable_logging!();
|
||||||
|
//! # log::info!("Starting guess_a_number_bot!");
|
||||||
|
//! # let bot = Bot::from_env();
|
||||||
//! // Setup is omitted...
|
//! // Setup is omitted...
|
||||||
//!
|
//!
|
||||||
//! Dispatcher::new(bot)
|
//! Dispatcher::new(bot)
|
||||||
|
|
Loading…
Add table
Reference in a new issue