Struct dementia::MatrixRoom [] [src]

pub struct MatrixRoom { /* fields omitted */ }

Represents a Matrix room from which events can be fetched from

Methods

impl MatrixRoom
[src]

[src]

Receive all new events in a room since the last time this function has been called

The first time this function is called, since there is no last time, only general information about the room is encoded in the events. In all later calls, the new messages are included.

Note: To prevent prevent infinite-loop situations between bots, a bot should never reply to a message of type notice and should only reply with messages of type notice.

Examples

[src]

Send a message to a room

Note: To prevent prevent infinite-loop situations between bots, a bot should never reply to messages with a message of type text. Instead, a message of type notice should be used. Thus, a bot should also never reply to a message of type notice.

Examples

let message = Message::Notice("Hallo".to_owned());
room.send_message(message);
let logo_url = String::from("https://www.rust-lang.org/logos/rust-logo-128x128.png");
let message = Message::Image{body: "Rust Logo".to_owned(), url: logo_url};
room.send_message(message);

[src]

Invite someone to a room

  • user_id – The fully qualified user ID of the invitee.

[src]

Send a message of type text to a room

Shortcut for send_message(Message::Text(…))

A bot should never reply to messages with a message of type text. Instead, a message of type notice should be used.

Examples

room.send_text("Hallo".to_owned());

[src]

Send a message of type emote to a room

Shortcut for send_message(Message::Emote(…))

An emote describes an action that is being performed. This corresponds to the IRC CTCP ACTION command and is usually induced by the prefix /me.

Examples

room.send_emote("is having trouble".to_owned());

[src]

Send a message of type notice to a room

Shortcut for send_message(Message::Notice(…))

A bot should always use a message of type notice, when replying to messages.

Examples

room.send_notice("Hallo".to_owned());

Trait Implementations

Auto Trait Implementations

impl !Send for MatrixRoom

impl !Sync for MatrixRoom