Documents who, w, finger, write, wall, ytalk and .plan files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
5.2 KiB
Maubot Plugin Development - Dev Onboarding
This guide walks you through setting up your development environment for building maubot plugins.
Prerequisites
- VS Code with the Remote-SSH extension
- SSH key pair - if you don't have one:
ssh-keygen -t ed25519 -C "your-email@example.com" - Your public key - send this to the admin:
cat ~/.ssh/id_ed25519.pub
Getting Connected
Once the admin has set up your account, you'll receive connection details.
1. Configure SSH
Add this to your SSH config file (~/.ssh/config on Mac/Linux, C:\Users\YOU\.ssh\config on Windows):
Host maubot-dev
HostName <server-ip>
User <your-username>
LocalForward 29316 127.0.0.1:29316
Replace <server-ip> and <your-username> with the values provided by your admin.
2. Connect with VS Code
- Open VS Code
- Press
F1(orCmd+Shift+P/Ctrl+Shift+P) - Type "Remote-SSH: Connect to Host"
- Select
maubot-dev - Wait for VS Code to connect
3. Open Your Plugin Folder
Once connected:
- Click "Open Folder"
- Navigate to
/home/<your-username>/plugins/hello_<your-username> - Click "OK"
You should see your starter plugin files.
Your First Plugin
Your starter plugin responds to two commands:
!hello- Says hello!ping- Responds with pong
Build and Deploy
-
Open the integrated terminal in VS Code (
Ctrl+``orView > Terminal) -
Build your plugin:
make buildThis creates a
.mbpfile in thedist/folder. -
Open the maubot admin UI:
- In your browser, go to: http://localhost:29316
- Log in (ask admin for credentials)
-
Upload your plugin:
- Go to "Plugins" tab
- Click "Upload new plugin"
- Select your
.mbpfile fromdist/
-
Create an instance:
- Go to "Instances" tab
- Click "Create instance"
- Select your plugin and a bot user
- Add
#devs-sandboxto allowed rooms - Click "Create"
-
Test in Matrix:
- Join the
#devs-sandboxroom - Type
!hello- your bot should respond!
- Join the
Plugin Development
File Structure
hello_yourname/
├── maubot.yaml # Plugin manifest (name, version, etc.)
├── hello_yourname/ # Python module
│ ├── __init__.py # Module init
│ └── bot.py # Your bot code
├── Makefile # Build commands
└── dist/ # Built .mbp files
Adding Commands
Edit hello_yourname/bot.py:
from maubot import Plugin, MessageEvent
from maubot.handlers import command
class Bot(Plugin):
@command.new("hello")
async def hello_command(self, evt: MessageEvent) -> None:
await evt.reply("Hello!")
# Add your new command here:
@command.new("dice")
async def dice_command(self, evt: MessageEvent) -> None:
import random
result = random.randint(1, 6)
await evt.reply(f"🎲 You rolled a {result}!")
Development Workflow
- Edit your code in VS Code
- Run
make buildin the terminal - In maubot admin, go to your instance and click "Reload"
- Test your changes in Matrix
Makefile Commands
| Command | Description |
|---|---|
make build |
Build the .mbp plugin file |
make check |
Check Python syntax |
make clean |
Remove built files |
Troubleshooting
"Connection refused" when opening localhost:29316
The SSH tunnel isn't working. Make sure:
- You're connected via VS Code Remote-SSH
- Your SSH config has the
LocalForwardline - Try disconnecting and reconnecting
Plugin doesn't appear in maubot
- Check that
make buildcompleted without errors - Make sure you uploaded the
.mbpfile from thedist/folder - Check the maubot logs for errors
Bot doesn't respond to commands
- Make sure the bot is in the room (check room members)
- Check that the room is in "allowed_rooms" in instance config
- Check maubot logs for errors
- Commands are case-sensitive:
!hellonot!Hello
Syntax errors
Run make check to validate Python syntax before building.
Need to see logs
In the maubot admin UI, go to "Logs" to see recent activity and errors.
Resources
Shared Server Tools
This is a shared Unix server. Classic tools for seeing who's around and communicating:
| Command | What it does |
|---|---|
who |
See who's logged in |
w |
Who's logged in + what they're doing |
finger <user> |
User info + their .plan file |
write <user> |
Send a message to their terminal |
wall |
Broadcast message to all logged-in users |
ytalk <user> |
Split-screen chat (both must be online) |
Your .plan file
Create ~/.plan to tell others what you're working on:
echo "Building a dice bot. Ask me about random numbers." > ~/.plan
Others can see it with finger yourname.
Getting Help
- Ask in
#devs-sandbox- other devs and admins can help - Use
writeorytalkif another dev is online - Check the maubot logs for error messages
- Review the maubot documentation