From fdaddb390266e7537bf0e8cfb635109cf7c4eff9 Mon Sep 17 00:00:00 2001 From: Lev Khoroshansky Date: Sun, 9 Oct 2022 19:41:52 +0300 Subject: [PATCH 1/5] fix: Sync docs & comments with code Former-commit-id: 6ebf51efeb068b0291922be16bc6bc7d0fadc9c4 --- examples/admin.rs | 4 ++-- src/utils/command.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/admin.rs b/examples/admin.rs index 4be9a543..fbbc1615 100644 --- a/examples/admin.rs +++ b/examples/admin.rs @@ -5,8 +5,8 @@ use teloxide::{prelude::*, types::ChatPermissions, utils::command::BotCommands}; // Derive BotCommands to parse text with a command into this enumeration. // -// 1. rename = "lowercase" turns all the commands into lowercase letters. -// 2. `description = "..."` specifies a text before all the commands. +// 1. `rename_rule = "lowercase"` turns all the commands into lowercase +// letters. 2. `description = "..."` specifies a text before all the commands. // // That is, you can just call Command::descriptions() to get a description of // your commands in this format: diff --git a/src/utils/command.rs b/src/utils/command.rs index 24e001cf..2d16f23b 100644 --- a/src/utils/command.rs +++ b/src/utils/command.rs @@ -233,7 +233,7 @@ pub trait BotCommands: Sized { /// Returns `PhantomData` that is used as a param of [`commands_repl`] /// - /// [`commands_repl`]: (crate::repls2::commands_repl) + /// [`commands_repl`]: (crate::repls::commands_repl) #[must_use] fn ty() -> PhantomData { PhantomData From a5419f3475d4c26f3e87585977cd96c03d7643da Mon Sep 17 00:00:00 2001 From: Lev Khoroshansky Date: Sun, 9 Oct 2022 19:42:20 +0300 Subject: [PATCH 2/5] fix: Grammar & typos Former-commit-id: b3fe220d9929c55840411d68e6db42a4e76e1618 --- CHANGELOG.md | 8 ++++---- MIGRATION_GUIDE.md | 6 +++--- README.md | 6 +++--- examples/db_remember.rs | 2 +- examples/dispatching_features.rs | 2 +- examples/heroku_ping_pong.rs | 2 +- src/dispatching/update_listeners/polling.rs | 2 +- src/utils/command.rs | 12 ++++++------ src/utils/html.rs | 4 ++-- src/utils/markdown.rs | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ea743ff..795ed08c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,7 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fix Api Unknown error (Can't parse entities) on message created with `utils::markdown::user_mention_or_link` if user full name contaiins some escapable symbols eg '.' +- Fix Api Unknown error (Can't parse entities) on message created with `utils::markdown::user_mention_or_link` if user full name contains some escapable symbols eg '.' ## 0.9.1 - 2022-05-27 @@ -188,7 +188,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `BotCommand::bot_commands` to obtain Telegram API commands ([issue 262](https://github.com/teloxide/teloxide/issues/262)). -- The `dispatching2` and `prelude2` modules. They presents a new dispatching model based on `dptree`. +- The `dispatching2` and `prelude2` modules. They present a new dispatching model based on `dptree`. ### Changed @@ -265,7 +265,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Remove the `reqwest` dependency. It's not needed after the [teloxide-core] integration. -- A storage persistency bug ([issue 304](https://github.com/teloxide/teloxide/issues/304)). +- A storage persistence bug ([issue 304](https://github.com/teloxide/teloxide/issues/304)). - Log errors from `Storage::{remove_dialogue, update_dialogue}` in `DialogueDispatcher` ([issue 302](https://github.com/teloxide/teloxide/issues/302)). - Mark all the functions of `Storage` as `#[must_use]`. @@ -371,7 +371,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Now methods which can send file to Telegram returns `tokio::io::Result`. Early its could panic ([issue 216](https://github.com/teloxide/teloxide/issues/216)). +- Now methods which can send file to Telegram returns `tokio::io::Result`. Early it could panic ([issue 216](https://github.com/teloxide/teloxide/issues/216)). - If a bot wasn't triggered for several days, it stops responding ([issue 223](https://github.com/teloxide/teloxide/issues/223)). ## 0.2.0 - 2020-02-25 diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 83ea0829..1449cca1 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -193,7 +193,7 @@ In order to make `Dispatcher` implement `Send`, `DispatcherBuilder::{default_han v0.6 of teloxide introduces a new dispatching model based on the [chain of responsibility pattern]. To use it, you need to replace `prelude` with `prelude2` and `dispatching` with `dispatching2`. Instead of using old REPLs, you should now use `teloxide::repls2`. -The whole design is different than the previous one based on Tokio streams. In this section, we are only to address the most common usage scenarios. +The whole design is different from the previous one based on Tokio streams. In this section, we are only to address the most common usage scenarios. First of all, now there are no streams. Instead of using streams, you use [`dptree`], which is a more suitable alternative for our purposes. Thus, if you previously used `Dispatcher::messages_handler`, now you should use `Update::filter_message()`, and so on. @@ -237,7 +237,7 @@ List of changed types: In teloxide `v0.4` (core `v0.2`) some API methods had wrong return types. This made them practically unusable as they've always returned parsing error. -On the offchance you were using the methods, you may need to adjust types in your code. +On the off-chance you were using the methods, you may need to adjust types in your code. List of changed return types: - `get_chat_administrators`: `ChatMember` -> `Vec` @@ -324,7 +324,7 @@ List of renamed items: #### Added `impl Clone` for {`CacheMe`, `DefaultParseMode`, `Throttle`} Previously said bot adaptors were lacking `Clone` implementation. -To workaround this issue it was proposed to wrap bot in `Arc`. +To work around this issue it was proposed to wrap bot in `Arc`. Now it's not required, so you can remove the `Arc`: ```diff diff --git a/README.md b/README.md index 2fb0010a..795a4006 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ $ set TELOXIDE_TOKEN= $ $env:TELOXIDE_TOKEN= ``` - 4. Make sure that your Rust compiler is up to date (`teloxide` currently requires rustc at least version 1.64): + 4. Make sure that your Rust compiler is up-to-date (`teloxide` currently requires rustc at least version 1.64): ```bash # If you're using stable $ rustup update stable @@ -82,7 +82,7 @@ tokio = { version = "1.8", features = ["rt-multi-thread", "macros"] } ### The dices bot -This bot replies with a dice throw to each received message: +This bot replies with a die throw to each received message: [[`examples/throw_dice.rs`](examples/throw_dice.rs)] @@ -326,7 +326,7 @@ Feel free to propose your own bot to our collection! - [`modos189/tg_blackbox_bot`](https://gitlab.com/modos189/tg_blackbox_bot) — Anonymous feedback for your Telegram project. - [`0xNima/spacecraft`](https://github.com/0xNima/spacecraft) — Yet another telegram bot to downloading Twitter spaces. - [`0xNima/Twideo`](https://github.com/0xNima/Twideo) — Simple Telegram Bot for downloading videos from Twitter via their links. - - [`mattrighetti/libgen-bot-rs`](https://github.com/mattrighetti/libgen-bot-rs) — Telgram bot to interface with libgen. + - [`mattrighetti/libgen-bot-rs`](https://github.com/mattrighetti/libgen-bot-rs) — Telegram bot to interface with libgen. - [`zamazan4ik/npaperbot-telegram`](https://github.com/zamazan4ik/npaperbot-telegram) — Telegram bot for searching via C++ proposals.
diff --git a/examples/db_remember.rs b/examples/db_remember.rs index de09db0d..980d1357 100644 --- a/examples/db_remember.rs +++ b/examples/db_remember.rs @@ -91,7 +91,7 @@ async fn got_number( } Command::Reset => { dialogue.reset().await?; - bot.send_message(msg.chat.id, "Number resetted.").await?; + bot.send_message(msg.chat.id, "Number reset.").await?; } } Ok(()) diff --git a/examples/dispatching_features.rs b/examples/dispatching_features.rs index 983f0002..6ce059d9 100644 --- a/examples/dispatching_features.rs +++ b/examples/dispatching_features.rs @@ -32,7 +32,7 @@ async fn main() { .endpoint(simple_commands_handler), ) .branch( - // Filter a maintainer by a used ID. + // Filter a maintainer by a user ID. dptree::filter(|cfg: ConfigParameters, msg: Message| { msg.from().map(|user| user.id == cfg.bot_maintainer).unwrap_or_default() }) diff --git a/examples/heroku_ping_pong.rs b/examples/heroku_ping_pong.rs index 6fe50847..59767047 100644 --- a/examples/heroku_ping_pong.rs +++ b/examples/heroku_ping_pong.rs @@ -10,7 +10,7 @@ // heroku create --buildpack emk/rust // ``` // -// To set buildpack for existing applicaton: +// To set buildpack for existing application: // // ``` // heroku buildpacks:set emk/rust diff --git a/src/dispatching/update_listeners/polling.rs b/src/dispatching/update_listeners/polling.rs index 5fb863f0..ffe8aa5a 100644 --- a/src/dispatching/update_listeners/polling.rs +++ b/src/dispatching/update_listeners/polling.rs @@ -225,7 +225,7 @@ where /// /// C->>P: next /// -/// P->>T: *Acknolegment of update(5)* +/// P->>T: *Acknowledgement of update(5)* /// T->>P: ok /// /// P->>C: None diff --git a/src/utils/command.rs b/src/utils/command.rs index 2d16f23b..785479d7 100644 --- a/src/utils/command.rs +++ b/src/utils/command.rs @@ -91,7 +91,7 @@ pub use teloxide_macros::BotCommands; /// Change a prefix for all commands (the default is `/`). /// /// 3. `#[command(description = "description")]` -/// Add a sumary description of commands before all commands. +/// Add a summary description of commands before all commands. /// /// 4. `#[command(parse_with = "parser")]` /// Change the parser of arguments. Possible values: @@ -115,7 +115,7 @@ pub use teloxide_macros::BotCommands; /// # } /// ``` /// -/// - `split` - separates a messsage by a given separator (the default is the +/// - `split` - separates a message by a given separator (the default is the /// space character) and parses each part into the corresponding arguments, /// which must implement [`FromStr`]. /// @@ -412,9 +412,9 @@ where return None; } let mut words = text.split_whitespace(); - let mut splited = words.next()?[prefix.len()..].split('@'); - let command = splited.next()?; - let bot = splited.next(); + let mut split = words.next()?[prefix.len()..].split('@'); + let command = split.next()?; + let bot = split.next(); match bot { Some(name) if name.eq_ignore_ascii_case(bot_name.as_ref()) => {} None => {} @@ -485,7 +485,7 @@ impl Display for CommandDescriptions<'_> { } } -// The rest of tests are integrational due to problems with macro expansion in +// The rest of tests are integration due to problems with macro expansion in // unit tests. #[cfg(test)] mod tests { diff --git a/src/utils/html.rs b/src/utils/html.rs index 407f0792..d2243d5d 100644 --- a/src/utils/html.rs +++ b/src/utils/html.rs @@ -95,7 +95,7 @@ pub fn code_inline(s: &str) -> String { /// style. /// /// Does not escape ' and " characters (as should be for usual HTML), because -/// they shoudn't be escaped by the [spec]. +/// they shouldn't be escaped by the [spec]. /// /// [spec]: https://core.telegram.org/bots/api#html-style #[must_use = "This function returns a new string, rather than mutating the argument, so calling it \ @@ -176,7 +176,7 @@ mod tests { assert_eq!( code_block_with_lang( "

pre-'formatted'\n & fixed-width \\code `block`

", - "\"" + "\"", ), concat!( "
",
diff --git a/src/utils/markdown.rs b/src/utils/markdown.rs
index 9c355444..976e0ab4 100644
--- a/src/utils/markdown.rs
+++ b/src/utils/markdown.rs
@@ -38,7 +38,7 @@ pub fn italic(s: &str) -> String {
               without using its output does nothing useful"]
 pub fn underline(s: &str) -> String {
     // In case of ambiguity between italic and underline entities
-    // ‘__’ is always greadily treated from left to right as beginning or end of
+    // ‘__’ is always greedily treated from left to right as beginning or end of
     // underline entity, so instead of ___italic underline___ we should use
     // ___italic underline_\r__, where \r is a character with code 13, which
     // will be ignored.

From 98150c401a32fd6cf88ec870e553bd313ad3ce28 Mon Sep 17 00:00:00 2001
From: Lev Khoroshansky 
Date: Sun, 9 Oct 2022 19:47:45 +0300
Subject: [PATCH 3/5] fix: Spacing

Former-commit-id: a9739c7da4f5629a120409daa6d3f468686d7224
---
 examples/admin.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/admin.rs b/examples/admin.rs
index fbbc1615..17f7373f 100644
--- a/examples/admin.rs
+++ b/examples/admin.rs
@@ -5,8 +5,8 @@ use teloxide::{prelude::*, types::ChatPermissions, utils::command::BotCommands};
 
 // Derive BotCommands to parse text with a command into this enumeration.
 //
-//  1. `rename_rule = "lowercase"` turns all the commands into lowercase
-// letters.  2. `description = "..."` specifies a text before all the commands.
+// 1. `rename_rule = "lowercase"` turns all the commands into lowercase letters.
+// 2. `description = "..."` specifies a text before all the commands.
 //
 // That is, you can just call Command::descriptions() to get a description of
 // your commands in this format:

From a57ff6056d00c3479dc87d9e6f8b39d53dc19387 Mon Sep 17 00:00:00 2001
From: Lev Khoroshansky 
Date: Sun, 9 Oct 2022 19:49:42 +0300
Subject: [PATCH 4/5] fix: Plural verb and better wording

Former-commit-id: 643ef423e87aa4f22f7b81d22c0fc8f6e83e3e13
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 795ed08c..7687aa9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -371,7 +371,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Fixed
 
-- Now methods which can send file to Telegram returns `tokio::io::Result`. Early it could panic ([issue 216](https://github.com/teloxide/teloxide/issues/216)).
+- Now methods which can send file to Telegram return `tokio::io::Result`. Before that it could panic ([issue 216](https://github.com/teloxide/teloxide/issues/216)).
 - If a bot wasn't triggered for several days, it stops responding ([issue 223](https://github.com/teloxide/teloxide/issues/223)).
 
 ## 0.2.0 - 2020-02-25

From 5fb01ee8d53b8791b25c1cbe9f4f112ff2160a10 Mon Sep 17 00:00:00 2001
From: Lev Khoroshansky 
Date: Sun, 9 Oct 2022 19:59:52 +0300
Subject: [PATCH 5/5] fix: No need for hyphens

Former-commit-id: aec777d89994acfe1f42b1568f5617bd90f135e7
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 795a4006..d25c150f 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ $ set TELOXIDE_TOKEN=
 $ $env:TELOXIDE_TOKEN=
 ```
 
- 4. Make sure that your Rust compiler is up-to-date (`teloxide` currently requires rustc at least version 1.64):
+ 4. Make sure that your Rust compiler is up to date (`teloxide` currently requires rustc at least version 1.64):
 ```bash
 # If you're using stable
 $ rustup update stable