🤖 An elegant Telegram bots framework for Rust https://docs.rs/teloxide
Find a file
2020-03-04 18:38:08 +02:00
.github/workflows Create rust.yml 2020-02-24 14:54:06 +06:00
src fix command 2020-03-04 18:38:08 +02:00
.gitignore Fix Clippy 2020-02-24 15:19:03 +06:00
Cargo.toml Fix the description 2020-02-24 14:49:39 +06:00
CHANGELOG.md Update CHANGELOG.md 2020-02-24 15:13:53 +06:00
LICENSE Init 2020-02-24 14:48:37 +06:00
Readme.md added Readme.md 2020-02-25 12:09:58 +02:00

teloxide-macros

The teloxide's procedural macros.

Example

use teloxide::utils::command::BotCommand;
#[derive(BotCommand, PartialEq, Debug)]
#[command(rename = "lowercase")]
enum AdminCommand {
    Mute,
    Ban,
}
let (command, args) = AdminCommand::parse("/ban 5 h", "bot_name").unwrap();
assert_eq!(command, AdminCommand::Ban);
assert_eq!(args, vec!["5", "h"]);

Enum attributes

  1. #[command(rename = "rule")] Rename all commands by rule. Allowed rules are lowercase. If you will not use this attribute, commands will be parsed by their original names.

  2. #[command(prefix = "prefix")] Change a prefix for all commands (the default is /).

  3. #[command(description = "description")] Add a sumary description of commands before all commands.

Variant attributes

  1. #[command(rename = "rule")] Rename one command by a rule. Allowed rules are lowercase, %some_name%, where %some_name% is any string, a new name.

  2. #[command(prefix = "prefix")] Change a prefix for one command (the default is /).

  3. #[command(description = "description")] Add a description of one command.

All variant attributes overlap the enum attributes.