Merge pull request #639 from teloxide/dev

Merge v0.9.1

Former-commit-id: ec1d41220c
This commit is contained in:
Hirrolot 2022-05-27 00:54:03 +06:00 committed by GitHub
commit 8f70513e8b
14 changed files with 54 additions and 47 deletions

View file

@ -18,7 +18,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-02-02
toolchain: nightly-2022-05-06
override: true
components: rustfmt
@ -37,7 +37,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-02-02
toolchain: nightly-2022-05-06
override: true
components: clippy
@ -65,7 +65,7 @@ jobs:
toolchain: beta
features: "--features full"
- rust: nightly
toolchain: nightly-2022-01-17
toolchain: nightly-2022-05-06
features: "--all-features"
- rust: msrv
toolchain: "1.58.0"

View file

@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## unreleased
## 0.9.1 - 2022-05-27
### Fixed
- Fix `#[command(rename = "...")]` for custom command names ([issue 633](https://github.com/teloxide/teloxide/issues/633)).
## 0.9.0 - 2022-04-27
### Added

View file

@ -1,6 +1,6 @@
[package]
name = "teloxide"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
description = "An elegant Telegram bots framework for Rust"
repository = "https://github.com/teloxide/teloxide"
@ -57,7 +57,7 @@ full = [
[dependencies]
teloxide-core = { version = "0.6.0", default-features = false }
teloxide-macros = { version = "0.6.1", optional = true }
teloxide-macros = { version = "0.6.2", optional = true }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }

View file

@ -18,17 +18,17 @@
<img src="https://img.shields.io/badge/API%20coverage-Up%20to%206.0%20(inclusively)-green.svg">
</a>
<a href="https://t.me/teloxide">
<img src="https://img.shields.io/badge/official%20chat-t.me%2Fteloxide-blueviolet">
<img src="https://img.shields.io/badge/support-t.me%2Fteloxide-blueviolet">
</a>
A full-featured framework that empowers you to easily build [Telegram bots](https://telegram.org/blog/bot-revolution) using the [`async`/`.await`](https://rust-lang.github.io/async-book/01_getting_started/01_chapter.html) syntax in [Rust](https://www.rust-lang.org/). It handles all the difficult stuff so you can focus only on your business logic.
A full-featured framework that empowers you to easily build [Telegram bots](https://telegram.org/blog/bot-revolution) using [Rust](https://www.rust-lang.org/). It handles all the difficult stuff so you can focus only on your business logic.
</div>
## Highlights
- **Declarative design.** teloxide is based upon [`dptree`], a functional-style [chain of responsibility] pattern that allows you to express pipelines of message processing in a highly declarative and extensible style.
- **Declarative design.** teloxide is based upon [`dptree`], a functional [chain of responsibility] pattern that allows you to express pipelines of message processing in a highly declarative and extensible style.
[`dptree`]: https://github.com/p0lunin/dptree
[`dptree`]: https://github.com/teloxide/dptree
[chain of responsibility]: https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern
- **Dialogues management subsystem.** Our dialogues management subsystem is simple and easy-to-use, and, furthermore, is agnostic of how/where dialogues are stored. For example, you can just replace a one line to achieve [persistence]. Out-of-the-box storages include [Redis] and [Sqlite].
@ -84,7 +84,7 @@ tokio = { version = "1.8", features = ["rt-multi-thread", "macros"] }
This bot replies with a dice throw to each received message:
([Full](examples/throw_dice.rs))
[[`examples/throw_dice.rs`](examples/throw_dice.rs)]
```rust,no_run
use teloxide::prelude::*;
@ -121,7 +121,7 @@ Commands are strongly typed and defined declaratively, similar to how we define
[structopt]: https://docs.rs/structopt/0.3.9/structopt/
[serde-json]: https://github.com/serde-rs/json
([Full](examples/command.rs))
[[`examples/command.rs`](examples/command.rs)]
```rust,no_run
use teloxide::{prelude::*, utils::command::BotCommands};
@ -188,7 +188,7 @@ A dialogue is typically described by an enumeration where each variant is one po
Below is a bot that asks you three questions and then sends the answers back to you:
([Full](examples/dialogue.rs))
[[`examples/dialogue.rs`](examples/dialogue.rs)]
```rust,ignore
use teloxide::{dispatching::dialogue::InMemStorage, prelude::*};
@ -341,28 +341,28 @@ A: Yes, see [`examples/purchase.rs`](examples/purchase.rs).
Feel free to propose your own bot to our collection!
- [WaffleLapkin/crate_upd_bot](https://github.com/WaffleLapkin/crate_upd_bot) -- A bot that notifies about crate updates.
- [mxseev/logram](https://github.com/mxseev/logram) -- Utility that takes logs from anywhere and sends them to Telegram.
- [alexkonovalov/PedigreeBot](https://github.com/alexkonovalov/PedigreeBot) -- A Telegram bot for building family trees.
- [Hermitter/tepe](https://github.com/Hermitter/tepe) -- A CLI to command a bot to send messages and files over Telegram.
- [mattrighetti/GroupActivityBot](https://github.com/mattrighetti/group-activity-bot-rs) -- Telegram bot that keeps track of user activity in groups.
- [mattrighetti/libgen-bot-rs](https://github.com/mattrighetti/libgen-bot-rs) -- Telgram bot to interface with libgen
- [dracarys18/grpmr-rs](https://github.com/dracarys18/grpmr-rs) -- A Telegram group manager bot with variety of extra features.
- [steadylearner/subreddit_reader](https://github.com/steadylearner/Rust-Full-Stack/tree/master/commits/teloxide/subreddit_reader) -- A bot that shows the latest posts at Rust subreddit.
- [myblackbeard/basketball-betting-bot](https://github.com/myblackbeard/basketball-betting-bot) -- The bot lets you bet on NBA games against your buddies.
- [ArtHome12/vzmuinebot](https://github.com/ArtHome12/vzmuinebot) -- Telegram bot for food menu navigate.
- [ArtHome12/cognito_bot](https://github.com/ArtHome12/cognito_bot) -- The bot is designed to anonymize messages to a group.
- [pro-vim/tg-vimhelpbot](https://github.com/pro-vim/tg-vimhelpbot) -- Link `:help` for Vim in Telegram.
- [sschiz/janitor-bot](https://github.com/sschiz/janitor-bot) -- A bot that removes users trying to join to a chat that is designed for comments.
- [slondr/BeerHolderBot](https://gitlab.com/slondr/BeerHolderBot) -- A bot that holds your beer.
- [MustafaSalih1993/Miss-Vodka-Telegram-Bot](https://github.com/MustafaSalih1993/Miss-Vodka-Telegram-Bot) -- A Telegram bot written in rust using "Teloxide" library.
- [x13a/tg-prompt](https://github.com/x13a/tg-prompt) -- Telegram prompt.
- [magnickolas/remindee-bot](https://github.com/magnickolas/remindee-bot) -- Telegram bot for managing reminders.
- [cyberknight777/knight-bot](https://gitlab.com/cyberknight777/knight-bot) -- A Telegram bot with variety of fun features.
- [wa7sa34cx/the-black-box-bot](https://github.com/wa7sa34cx/the-black-box-bot) -- This is the Black Box Telegram bot. You can hold any items in it.
- [crapstone/hsctt](https://codeberg.org/crapstones-bots/hsctt) -- A Telegram bot that searches for HTTP status codes in all messages and replies with the text form.
- [alenpaul2001/AurSearchBot](https://gitlab.com/alenpaul2001/aursearchbot) -- Telegram bot for searching AUR in inline mode.
- [studiedlist/EddieBot](https://gitlab.com/studiedlist/eddie-bot) -- Chatting bot with several entertainment features
- [WaffleLapkin/crate_upd_bot](https://github.com/WaffleLapkin/crate_upd_bot) A bot that notifies about crate updates.
- [mxseev/logram](https://github.com/mxseev/logram) Utility that takes logs from anywhere and sends them to Telegram.
- [alexkonovalov/PedigreeBot](https://github.com/alexkonovalov/PedigreeBot) A Telegram bot for building family trees.
- [Hermitter/tepe](https://github.com/Hermitter/tepe) A CLI to command a bot to send messages and files over Telegram.
- [mattrighetti/GroupActivityBot](https://github.com/mattrighetti/group-activity-bot-rs) Telegram bot that keeps track of user activity in groups.
- [mattrighetti/libgen-bot-rs](https://github.com/mattrighetti/libgen-bot-rs) Telgram bot to interface with libgen
- [dracarys18/grpmr-rs](https://github.com/dracarys18/grpmr-rs) A Telegram group manager bot with variety of extra features.
- [steadylearner/subreddit_reader](https://github.com/steadylearner/Rust-Full-Stack/tree/master/commits/teloxide/subreddit_reader) A bot that shows the latest posts at Rust subreddit.
- [myblackbeard/basketball-betting-bot](https://github.com/myblackbeard/basketball-betting-bot) The bot lets you bet on NBA games against your buddies.
- [ArtHome12/vzmuinebot](https://github.com/ArtHome12/vzmuinebot) Telegram bot for food menu navigate.
- [ArtHome12/cognito_bot](https://github.com/ArtHome12/cognito_bot) The bot is designed to anonymize messages to a group.
- [pro-vim/tg-vimhelpbot](https://github.com/pro-vim/tg-vimhelpbot) Link `:help` for Vim in Telegram.
- [sschiz/janitor-bot](https://github.com/sschiz/janitor-bot) A bot that removes users trying to join to a chat that is designed for comments.
- [slondr/BeerHolderBot](https://gitlab.com/slondr/BeerHolderBot) A bot that holds your beer.
- [MustafaSalih1993/Miss-Vodka-Telegram-Bot](https://github.com/MustafaSalih1993/Miss-Vodka-Telegram-Bot) A Telegram bot written in rust using "Teloxide" library.
- [x13a/tg-prompt](https://github.com/x13a/tg-prompt) Telegram prompt.
- [magnickolas/remindee-bot](https://github.com/magnickolas/remindee-bot) Telegram bot for managing reminders.
- [cyberknight777/knight-bot](https://gitlab.com/cyberknight777/knight-bot) A Telegram bot with variety of fun features.
- [wa7sa34cx/the-black-box-bot](https://github.com/wa7sa34cx/the-black-box-bot) This is the Black Box Telegram bot. You can hold any items in it.
- [crapstone/hsctt](https://codeberg.org/crapstones-bots/hsctt) A Telegram bot that searches for HTTP status codes in all messages and replies with the text form.
- [alenpaul2001/AurSearchBot](https://gitlab.com/alenpaul2001/aursearchbot) Telegram bot for searching AUR in inline mode.
- [studiedlist/EddieBot](https://gitlab.com/studiedlist/eddie-bot) — Chatting bot with several entertainment features.
## Contributing

View file

@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2022-02-02"
channel = "nightly-2022-05-06"
components = ["rustfmt", "clippy"]
profile = "minimal"

View file

@ -15,7 +15,6 @@
| `cache-me` | Enables the [`CacheMe`](adaptors::CacheMe) bot adaptor. |
| `trace-adaptor` | Enables the [`Trace`](adaptors::Trace) bot adaptor. |
| `erased` | Enables the [`ErasedRequester`](adaptors::ErasedRequester) bot adaptor. |
| `frunk` | Enables [`teloxide::utils::UpState`]. |
| `full` | Enables all the features except `nightly`. |
| `nightly` | Enables nightly-only features (see the [teloxide-core features]). |

View file

@ -1,10 +1,10 @@
//! A full-featured framework that empowers you to easily build [Telegram bots]
//! using the [`async`/`.await`] syntax in [Rust]. It handles all the difficult
//! stuff so you can focus only on your business logic.
//! using [Rust]. It handles all the difficult stuff so you can focus only on
//! your business logic.
//!
//! For a high-level overview, see [our GitHub repository](https://github.com/teloxide/teloxide).
//!
//! ([Full](https://github.com/teloxide/teloxide/blob/master/examples/throw_dice.rs))
//! [[`examples/throw_dice.rs`](https://github.com/teloxide/teloxide/blob/master/examples/throw_dice.rs)]
//! ```no_run
//! use teloxide::prelude::*;
//!
@ -25,7 +25,7 @@
//!
//! <div align="center">
//! <kbd>
//! <img src=https://github.com/teloxide/teloxide/raw/master/media/DICES_BOT.gif />
//! <img src=https://github.com/teloxide/teloxide/raw/master/media/throw-dice.gif width=420px />
//! </kbd>
//! </div>
//!

View file

@ -6,6 +6,3 @@ pub mod markdown;
pub(crate) mod shutdown_token;
pub use teloxide_core::net::client_from_env;
#[cfg(feature = "frunk")]
pub use up_state::UpState;

View file

@ -160,8 +160,10 @@ pub use teloxide_macros::BotCommands;
/// All variant attributes override the corresponding `enum` attributes.
///
/// 1. `#[command(rename = "rule")]`
/// Rename one command by a rule. Allowed rules are `lowercase`, `%some_name%`,
/// where `%some_name%` is any string, a new name.
/// Rename one command by a rule. Allowed rules are `lowercase`, `UPPERCASE`,
/// `PascalCase`, `camelCase`, `snake_case`, `SCREAMING_SNAKE_CASE`,
/// `kebab-case`, `SCREAMING-KEBAB-CASE`, and `%some_name%`, where `%some_name%`
/// is any string, a new name.
///
/// 2. `#[command(description = "description")]`
/// Give your command a description. Write `"off"` for `"description"` to hide a
@ -323,7 +325,7 @@ impl<'a> CommandDescriptions<'a> {
/// assert_eq!(
/// descriptions.username("username_of_the_bot").to_string(),
/// "/start@username_of_the_bot — start this bot\n/help@username_of_the_bot — show this \
/// message"
/// message"
/// );
/// ```
pub fn username(self, bot_username: &'a str) -> Self {

View file

@ -218,6 +218,8 @@ fn rename_rules() {
GggGgg,
#[command(rename = "SCREAMING-KEBAB-CASE")]
HhhHhh,
#[command(rename = "Bar")]
Foo,
}
assert_eq!(DefaultCommands::AaaAaa, DefaultCommands::parse("/aaaaaa", "").unwrap());
@ -228,9 +230,10 @@ fn rename_rules() {
assert_eq!(DefaultCommands::FffFff, DefaultCommands::parse("/FFF_FFF", "").unwrap());
assert_eq!(DefaultCommands::GggGgg, DefaultCommands::parse("/ggg-ggg", "").unwrap());
assert_eq!(DefaultCommands::HhhHhh, DefaultCommands::parse("/HHH-HHH", "").unwrap());
assert_eq!(DefaultCommands::Foo, DefaultCommands::parse("/Bar", "").unwrap());
assert_eq!(
"/aaaaaa\n/BBBBBB\n/CccCcc\n/dddDdd\n/eee_eee\n/FFF_FFF\n/ggg-ggg\n/HHH-HHH",
"/aaaaaa\n/BBBBBB\n/CccCcc\n/dddDdd\n/eee_eee\n/FFF_FFF\n/ggg-ggg\n/HHH-HHH\n/Bar",
DefaultCommands::descriptions().to_string()
);
}