From 4494acda885f9ed4cb8e5b0889a24074333a5b2a Mon Sep 17 00:00:00 2001 From: Hirrolot Date: Thu, 26 May 2022 23:48:43 +0600 Subject: [PATCH 1/3] Test the `rename` attribute --- Cargo.toml | 2 +- tests/command.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 25c9bde4..8ac124e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 = { git = "https://github.com/teloxide/teloxide-macros.git", rev = "e344b11dcc0466d1cbbef1139e8cd0646e776188", optional = true } serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } diff --git a/tests/command.rs b/tests/command.rs index a522b2a3..b3e6609e 100644 --- a/tests/command.rs +++ b/tests/command.rs @@ -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() ); } From 1fcf44d380eaec1a7a9bc4f8b550cd97cde1f369 Mon Sep 17 00:00:00 2001 From: Hirrolot Date: Thu, 26 May 2022 23:53:01 +0600 Subject: [PATCH 2/3] Update the changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec99c9a7..3a36f5f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## unreleased +### Fixed + + - Fix `#[command(rename = "...")]` for custom command names ([issue 633](https://github.com/teloxide/teloxide/issues/633)). + ## 0.9.0 - 2022-04-27 ### Added From e7de79b97584ec84b011e16402bd82f7ac9a71a3 Mon Sep 17 00:00:00 2001 From: Hirrolot Date: Fri, 27 May 2022 00:12:03 +0600 Subject: [PATCH 3/3] Update `teloxide-macros` to v0.6.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8ac124e2..0fe4cc3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ full = [ [dependencies] teloxide-core = { version = "0.6.0", default-features = false } -teloxide-macros = { git = "https://github.com/teloxide/teloxide-macros.git", rev = "e344b11dcc0466d1cbbef1139e8cd0646e776188", optional = true } +teloxide-macros = { version = "0.6.2", optional = true } serde_json = "1.0" serde = { version = "1.0", features = ["derive"] }