Skip to main content

Crate rust_tg_bot_macros

Crate rust_tg_bot_macros 

Source
Expand description

Procedural macros for the rust-tg-bot Telegram Bot framework.

This crate provides the BotCommands derive macro, which turns an enum into a self-parsing command handler with automatic help-text generation and Telegram setMyCommands integration.

§Example

use rust_tg_bot_macros::BotCommands;

#[derive(BotCommands, Clone)]
#[command(rename_rule = "lowercase")]
enum Command {
    #[command(description = "Display help text")]
    Help,
    #[command(description = "Start the bot")]
    Start,
    #[command(description = "Set username")]
    Username(String),
    #[command(description = "Set age")]
    Age(u32),
}

Derive Macros§

BotCommands
Derive macro that generates command-parsing infrastructure for a Telegram bot.