pub struct CommandDescriptions<'a> { /* private fields */ }
Expand description

Command descriptions that can be shown to the user (e.g. as a part of /help message)

Most of the time you don’t need to create this struct yourself as it’s returned from BotCommands::descriptions.

Implementations§

Creates new CommandDescriptions from a list of command descriptions.

Sets the global description of these commands.

Sets the username of the bot.

After this method is called, returned instance of CommandDescriptions will append @bot_username to all commands. This is useful in groups, to disambiguate commands for different bots.

Examples
use teloxide::utils::command::{CommandDescription, CommandDescriptions};

let descriptions = CommandDescriptions::new(&[
    CommandDescription { prefix: "/", command: "start", description: "start this bot" },
    CommandDescription { prefix: "/", command: "help", description: "show this message" },
]);

assert_eq!(descriptions.to_string(), "/start — start this bot\n/help — show this message");
assert_eq!(
    descriptions.username("username_of_the_bot").to_string(),
    "/start@username_of_the_bot — start this bot\n/help@username_of_the_bot — show this \
     message"
);

Sets the username of the bot.

This is the same as username, but uses value returned from get_me method to get the username.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Unerase this erased pointer. Read more
Available on non-enforce_1_1_0_semantics only.
Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
Turn this erasable pointer into an erased pointer. Read more

Returns the argument unchanged.

Converts to this type from a reference to the input type.
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more