Skip to main content

Bot

Trait Bot 

Source
pub trait Bot: Sized {
    // Required method
    fn handlers() -> Vec<HandlerEntry<Self>>;

    // Provided method
    fn help() -> Vec<CommandHelp> { ... }
}
Expand description

A bot type that gives its list of handlers.

The #[bot] macro implements this trait. Implement it yourself only for a bot that you make without the macro.

TestBot uses this trait to send a test line through the handlers of the bot.

Required Methods§

Source

fn handlers() -> Vec<HandlerEntry<Self>>

Returns a new list with one entry for each handler of the bot.

Provided Methods§

Source

fn help() -> Vec<CommandHelp>

Returns the help text of each command handler, for !help.

Give one entry for each handler with a Trigger::Command, in the order of Bot::handlers: !help pairs each entry with the trigger of its handler. When the lists do not agree, each command shows only its name.

The #[bot] and #[plugin] macros implement this from the signature and the doc comment of each command. The default gives no help.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§