mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Document BotCommand
methods
This commit is contained in:
parent
5bd134bc21
commit
8116059ba3
1 changed files with 20 additions and 3 deletions
|
@ -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<N>(s: &str, bot_name: N) -> Result<Self, ParseError>
|
||||
/// Parses a command.
|
||||
///
|
||||
/// `bot_username` is required to parse commands like
|
||||
/// `/cmd@username_of_the_bot`.
|
||||
fn parse<N>(s: &str, bot_username: N) -> Result<Self, ParseError>
|
||||
where
|
||||
N: Into<String>;
|
||||
|
||||
/// 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<crate::types::BotCommand>;
|
||||
|
||||
/// Returns `PhantomData<Self>` that is used as a param of [`commands_repl`]
|
||||
///
|
||||
/// [`commands_repl`]: (crate::repls2::commands_repl)
|
||||
fn ty() -> PhantomData<Self> {
|
||||
PhantomData
|
||||
}
|
||||
fn bot_commands() -> Vec<crate::types::BotCommand>;
|
||||
}
|
||||
|
||||
pub type PrefixedBotCommand = String;
|
||||
|
|
Loading…
Reference in a new issue