[][src]Trait matrix_bot_api::handlers::MessageHandler

pub trait MessageHandler {
    fn handle_message(
        &mut self,
        bot: &ActiveBot,
        message: &Message
    ) -> HandleResult; fn init_handler(&mut self, _bot: &ActiveBot) { ... } }

Any struct that implements this trait can be passed to a MatrixBot. The bot will call handle_message() on each arriving text-message The result HandleResult defines if handle_message() of other handlers will be called with this message or not.

The bot will also call init_handler() on startup to allow handlers to setup any background work

Required methods

fn handle_message(&mut self, bot: &ActiveBot, message: &Message) -> HandleResult

Will be called for every text message send to a room the bot is in

Loading content...

Provided methods

fn init_handler(&mut self, _bot: &ActiveBot)

Will be called once the bot has started

Loading content...

Implementors

impl MessageHandler for StatelessHandler[src]

Loading content...