Skip to main content

Crate botkit_matrix

Crate botkit_matrix 

Source
Expand description

Matrix implementation for botkit

This crate provides Matrix platform support for the botkit unified bot framework. It uses the matrix-sdk crate for protocol handling, including E2E encryption.

§Example

use botkit_matrix::{MatrixBot, MatrixConfig};
use botkit_core::extractor::User;

async fn ping() -> &'static str { "Pong!" }
async fn greet(user: User) -> String { format!("Hello, {}!", user.name) }

let config = MatrixConfig::new("https://matrix.org")
    .password_auth("@bot:matrix.org", "password")
    .command_prefix("!");

MatrixBot::new(config)
    .command("ping", ping)
    .command("greet", greet)
    .reaction("👍", on_thumbsup)
    .run()
    .await
    .unwrap();

Modules§

action

Structs§

MatrixBot
Matrix bot builder
MatrixClient
Matrix client wrapper
MatrixConfig
Matrix bot configuration
MatrixContextData
Matrix context data - implements ContextData for platform abstraction
OwnedDeviceId
Owned variant of DeviceId
OwnedEventId
Owned variant of EventId
OwnedRoomId
Owned variant of RoomId
OwnedUserId
Owned variant of UserId
Room
A struct containing methods that are common for Joined, Invited and Left Rooms

Enums§

MatrixAuth
Authentication options for Matrix
RoomState
Enum keeping track in which state the room is, e.g. if our own user is joined, RoomState::Invited, or has left the room.