[−][src]Struct matrix_bot_api::MatrixBot
Methods
impl MatrixBot
[src]
pub fn new<M>(handler: M) -> MatrixBot where
M: MessageHandler + 'static,
[src]
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]
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]
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
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.