mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-31 16:40:37 +01:00
Fix some places with remaining BotCommand
(w/o s
)
This commit is contained in:
parent
91bea5be5e
commit
6922128cb6
3 changed files with 5 additions and 5 deletions
|
@ -3,7 +3,7 @@ use std::{error::Error, str::FromStr};
|
||||||
use chrono::Duration;
|
use chrono::Duration;
|
||||||
use teloxide::{prelude2::*, types::ChatPermissions, utils::command::BotCommands};
|
use teloxide::{prelude2::*, types::ChatPermissions, utils::command::BotCommands};
|
||||||
|
|
||||||
// Derive BotCommand to parse text with a command into this enumeration.
|
// Derive BotCommands to parse text with a command into this enumeration.
|
||||||
//
|
//
|
||||||
// 1. rename = "lowercase" turns all the commands into lowercase letters.
|
// 1. rename = "lowercase" turns all the commands into lowercase letters.
|
||||||
// 2. `description = "..."` specifies a text before all the commands.
|
// 2. `description = "..."` specifies a text before all the commands.
|
||||||
|
|
|
@ -209,7 +209,7 @@ pub use teloxide_macros::BotCommands;
|
||||||
/// specific variant.
|
/// specific variant.
|
||||||
///
|
///
|
||||||
/// [`FromStr`]: https://doc.rust-lang.org/std/str/trait.FromStr.html
|
/// [`FromStr`]: https://doc.rust-lang.org/std/str/trait.FromStr.html
|
||||||
/// [`BotCommand`]: crate::utils::command::BotCommand
|
/// [`BotCommands`]: crate::utils::command::BotCommands
|
||||||
pub trait BotCommands: Sized {
|
pub trait BotCommands: Sized {
|
||||||
/// Parses a command.
|
/// Parses a command.
|
||||||
///
|
///
|
||||||
|
|
|
@ -200,7 +200,7 @@ fn descriptions_off() {
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "macros")]
|
#[cfg(feature = "macros")]
|
||||||
fn rename_rules() {
|
fn rename_rules() {
|
||||||
#[derive(BotCommand, Debug, PartialEq)]
|
#[derive(BotCommands, Debug, PartialEq)]
|
||||||
enum DefaultCommands {
|
enum DefaultCommands {
|
||||||
#[command(rename = "lowercase")]
|
#[command(rename = "lowercase")]
|
||||||
AaaAaa,
|
AaaAaa,
|
||||||
|
@ -230,7 +230,7 @@ fn rename_rules() {
|
||||||
assert_eq!(DefaultCommands::HhhHhh, DefaultCommands::parse("/HHH-HHH", "").unwrap());
|
assert_eq!(DefaultCommands::HhhHhh, DefaultCommands::parse("/HHH-HHH", "").unwrap());
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"/aaaaaa\n/BBBBBB\n/CccCcc\n/dddDdd\n/eee_eee\n/FFF_FFF\n/ggg-ggg\n/HHH-HHH\n",
|
"/aaaaaa\n/BBBBBB\n/CccCcc\n/dddDdd\n/eee_eee\n/FFF_FFF\n/ggg-ggg\n/HHH-HHH",
|
||||||
DefaultCommands::descriptions()
|
DefaultCommands::descriptions().to_string()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue