Merge pull request #743 from TmLev/master

Sync docs & comments with code, fix grammar and typos
This commit is contained in:
Waffle Maybe 2022-10-10 20:25:43 +04:00 committed by GitHub
commit 512e785999
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 25 additions and 25 deletions

View file

@ -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<T>`. Early its could panic ([issue 216](https://github.com/teloxide/teloxide/issues/216)).
- Now methods which can send file to Telegram return `tokio::io::Result<T>`. 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

View file

@ -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<ChatMember>`
@ -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

View file

@ -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.
<details>

View file

@ -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:

View file

@ -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(())

View file

@ -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()
})

View file

@ -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

View file

@ -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

View file

@ -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`].
///
@ -233,7 +233,7 @@ pub trait BotCommands: Sized {
/// Returns `PhantomData<Self>` 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<Self> {
PhantomData
@ -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 {

View file

@ -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(
"<p>pre-'formatted'\n & fixed-width \\code `block`</p>",
"<html>\""
"<html>\"",
),
concat!(
"<pre><code class=\"language-&lt;html&gt;&quot;\">",

View file

@ -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.