Struct matrix_bot_api::MatrixBot [−][src]
pub struct MatrixBot { /* fields omitted */ }
Methods
impl MatrixBot
[src]
impl MatrixBot
pub fn new<M>(handler: M) -> MatrixBot where
M: MessageHandler + 'static,
[src]
pub fn new<M>(handler: M) -> MatrixBot where
M: MessageHandler + 'static,
Consumes any struct that implements the MessageHandler-trait.
pub fn add_handler<M>(&mut self, handler: M) where
M: MessageHandler + 'static,
[src]
pub fn add_handler<M>(&mut self, handler: M) where
M: MessageHandler + 'static,
Add an additional handler. Each message will be given to all registered handlers until one of them returns "HandleResult::StopHandling".
pub fn set_verbose(&mut self, verbose: bool)
[src]
pub fn set_verbose(&mut self, verbose: bool)
If true, will print all Matrix-message coming in and going out (quite verbose!) to stdout Default: false
pub fn run(self, user: &str, password: &str, homeserver_url: &str)
[src]
pub fn run(self, user: &str, password: &str, homeserver_url: &str)
Blocking call that runs as long as the Bot is running. Will call for each incoming text-message the given MessageHandler. Bot will automatically join all rooms it is invited to. Will return on shutdown only. All messages prior to run() will be ignored.
pub fn shutdown(&self)
[src]
pub fn shutdown(&self)
Will shutdown the bot. The bot will not leave any rooms.
pub fn leave_room(&self, room_id: &str)
[src]
pub fn leave_room(&self, room_id: &str)
Will leave the given room (give room-id, not room-name)
pub fn send_message(&self, msg: &str, room: &str, msgtype: MessageType)
[src]
pub fn send_message(&self, msg: &str, room: &str, msgtype: MessageType)
Sends a message to a given room, with a given message-type.
- msg: The incoming message
- room: The room-id, the message should be sent to
- msgtype: Type of message (text or notice)