[][src]Struct matrix_bot_api::MatrixBot

pub struct MatrixBot { /* fields omitted */ }

Methods

impl MatrixBot[src]

pub fn new<M>(handler: M) -> MatrixBot where
    M: MessageHandler + 'static, 
[src]

Consumes any struct that implements the MessageHandler-trait.

pub fn add_handler<M>(&mut self, handler: M) where
    M: MessageHandler + 'static, 
[src]

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]

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]

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]

Will shutdown the bot. The bot will not leave any rooms.

pub fn leave_room(&self, room_id: &str)[src]

Will leave the given room (give room-id, not room-name)

pub fn send_message(&self, msg: &str, room: &str, msgtype: MessageType)[src]

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)

Auto Trait Implementations

impl !Send for MatrixBot

impl !Sync for MatrixBot

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T

impl<T> Erased for T