mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-22 06:45:37 +01:00
fixed descriptions (now Command::descriptions() does not display " - " when there is no description)
This commit is contained in:
parent
61f06a5e7a
commit
cb3fde7191
1 changed files with 2 additions and 2 deletions
|
@ -84,7 +84,7 @@ pub fn derive_telegram_command_enum(tokens: TokenStream) -> TokenStream {
|
||||||
let variant_str2 = variant_str1.clone();
|
let variant_str2 = variant_str1.clone();
|
||||||
let variant_description = variant_infos
|
let variant_description = variant_infos
|
||||||
.iter()
|
.iter()
|
||||||
.map(|info| info.description.as_deref().unwrap_or(""));
|
.map(|info| info.description.as_deref().map(|e| format!(" - {}", e)).unwrap_or(String::new()));
|
||||||
|
|
||||||
let ident = &input.ident;
|
let ident = &input.ident;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ pub fn derive_telegram_command_enum(tokens: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn descriptions() -> String {
|
fn descriptions() -> String {
|
||||||
std::concat!(#global_description #(#variant_str2, " - ", #variant_description, '\n'),*).to_string()
|
std::concat!(#global_description #(#variant_str2, #variant_description, '\n'),*).to_string()
|
||||||
}
|
}
|
||||||
fn parse<'a, 'b>(s: &'a str, bot_name: &'b str) -> Option<(Self, Vec<&'a str>)> {
|
fn parse<'a, 'b>(s: &'a str, bot_name: &'b str) -> Option<(Self, Vec<&'a str>)> {
|
||||||
let mut words = s.split_whitespace();
|
let mut words = s.split_whitespace();
|
||||||
|
|
Loading…
Add table
Reference in a new issue