diff --git a/src/utils/command.rs b/src/utils/command.rs index 6fcf06a2..8faf06d8 100644 --- a/src/utils/command.rs +++ b/src/utils/command.rs @@ -206,14 +206,31 @@ pub use teloxide_macros::BotCommand; /// [`FromStr`]: https://doc.rust-lang.org/std/str/trait.FromStr.html /// [`BotCommand`]: crate::utils::command::BotCommand pub trait BotCommand: Sized { - fn descriptions() -> String; - fn parse(s: &str, bot_name: N) -> Result + /// Parses a command. + /// + /// `bot_username` is required to parse commands like + /// `/cmd@username_of_the_bot`. + fn parse(s: &str, bot_username: N) -> Result where N: Into; + + /// Returns descriptions of the commands suitable to be shown to the user + /// (for example when `/help` command is used). + fn descriptions() -> String; + + /// Returns a vector of [`types::BotCommand`] that can be used with + /// [`set_my_commands`]. + /// + /// [`types::BotCommand`]: crate::types::BotCommand + /// [`set_my_commands`]: crate::requests::Requester::set_my_commands + fn bot_commands() -> Vec; + + /// Returns `PhantomData` that is used as a param of [`commands_repl`] + /// + /// [`commands_repl`]: (crate::repls2::commands_repl) fn ty() -> PhantomData { PhantomData } - fn bot_commands() -> Vec; } pub type PrefixedBotCommand = String;