Maubot
Maubot is a plugin-based bot system for Matrix. Install plugins for various features without writing code.
Features
- Plugin system - Add/remove features easily
- Web UI - Manage bots via browser
- Multiple instances - Run many bots from one Maubot
- Hot reload - Update plugins without restart
Installation
Docker (Recommended)
docker-compose.yml
version: '3'
services:
maubot:
image: dock.mau.dev/maubot/maubot:latest
restart: unless-stopped
ports:
- "29316:29316"
volumes:
- ./maubot-data:/data
docker compose up -d
# Access UI at http://localhost:29316/_matrix/maubot/
pip Installation
pip install maubot
mbc init
mbc run
Configuration
config.yaml
server:
hostname: 0.0.0.0
port: 29316
public_url: https://maubot.example.com
database: sqlite:///maubot.db
homeservers:
example.com:
url: https://matrix.example.com
admins:
admin: "your-password-hash"
Generate password hash:
mbc auth -u admin
Using the Web UI
- Go to
http://localhost:29316/_matrix/maubot/ - Login with admin credentials
- Clients tab → Add bot user credentials
- Plugins tab → Upload plugins
- Instances tab → Create bot instances
Popular Plugins
Utility
| Plugin | Description |
|---|---|
| echo | Echo messages back |
| dice | Roll dice |
| reminder | Set reminders |
| translate | Translate messages |
Fun
| Plugin | Description |
|---|---|
| xkcd | XKCD comics |
| giphy | GIF search |
| urban | Urban Dictionary |
Management
| Plugin | Description |
|---|---|
| welcome | Welcome new users |
| reactbot | Auto-react |
| rss | RSS feeds |
| gitlab | GitLab notifications |
Installing Plugins
From Web UI
- Download
.mbpfile from plugin repo - Plugins tab → Upload
- Create instance with plugin
From Command Line
# Build plugin
mbc build
# Upload to maubot
mbc upload -s http://localhost:29316 plugin.mbp
Creating an Instance
- Clients → Add Matrix account for bot
- Instances → New Instance
- Select plugin, client, primary room
- Configure plugin settings
- Start instance
Writing Plugins
Basic Plugin Structure
from maubot import Plugin, MessageEvent
from maubot.handlers import command
class MyPlugin(Plugin):
@command.new()
async def hello(self, evt: MessageEvent) -> None:
await evt.reply("Hello, World!")
Plugin Metadata
maubot.yaml
maubot: 0.1.0
id: com.example.myplugin
version: 1.0.0
license: MIT
modules:
- myplugin
main_class: MyPlugin
Building
mbc build -o myplugin.mbp
Configuration for Plugins
Plugins can have configurable settings:
from maubot import Plugin
from mautrix.util.config import BaseProxyConfig, ConfigUpdateHelper
class Config(BaseProxyConfig):
def do_update(self, helper: ConfigUpdateHelper) -> None:
helper.copy("greeting")
class MyPlugin(Plugin):
async def start(self) -> None:
self.config.load_and_update()
@command.new()
async def greet(self, evt: MessageEvent) -> None:
await evt.reply(self.config["greeting"])
Resources
Next: Mjolnir →