mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-23 07:09:34 +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_description = variant_infos
|
||||
.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;
|
||||
|
||||
|
@ -105,7 +105,7 @@ pub fn derive_telegram_command_enum(tokens: TokenStream) -> TokenStream {
|
|||
}
|
||||
}
|
||||
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>)> {
|
||||
let mut words = s.split_whitespace();
|
||||
|
|
Loading…
Add table
Reference in a new issue