@kotori-bot/makichan
v1.1.1
Published
a kotori project kotori project
Downloads
100
Readme
@kotori-bot/makichan
A lightweight HTTP-based notification pusher for Kotori bot framework. Send messages to any connected platform via a simple HTTP call based on Kotori Bot Framework.
Supports any Kotori adapters. E.g. OneBot, Official QQ, WeChat, Telegram, Discord, DingTalk, and more.
How It Works
Your Server / Script
│
▼
POST /maki ──────────────► @kotori-bot/makichan
{ token, title, content } │
├──► QQ Group (via OneBot)
├──► Telegram Chat
└──► Discord Channel- You send an HTTP request with a
token,title, andcontent. - The plugin looks up the token in its config to find the targets.
- The message is dispatched to every configured target on the matching Kotori adapter.
Config
In kotori.toml, add a [plugin.makichan] section:
[[plugin.makichan.rules]]
token = "your-secret-token-here"
targets = [
{ identity = "cmd-test", groupId = "123456789" },
{ identity = "qq-adapter", userId = "abc123" }
]
[[plugin.makichan.rules]]
token = "another-token"
targets = [
{ identity = "discord-bot", guildId = "xxx", channelId = "yyy" }
]Rule Fields
| Field | Type | Description |
|-------|------|-------------|
| token | string | Secret key used in the HTTP request to identify this rule. |
| targets | array | List of targets to deliver messages to. |
Target Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| identity | string | Yes | The adapter's unique identity string (defined in your adapter config). |
| userId | string \| number | No | Target user ID for private messages. |
| groupId | string \| number | No | Target group ID for group messages. |
| guildId | string \| number | No | Target guild/server ID (for Discord-like platforms). |
| channelId | string \| number | No | Target channel ID (for Discord-like platforms). |
Note: At least one of
userId,groupId, orguildId + channelIdmust be provided. IfuserIdis present, a private message is sent. IfgroupIdis present, a group message is sent. IfguildId+channelIdare present, a channel message is sent. Priority:userId>groupId>guildId + channelId.
Usage
POST (Recommended)
curl -X POST http://127.0.0.1:720/maki \
-H "Content-Type: application/json" \
-d '{
"token": "your-secret-token-here",
"title": "Server Alert",
"content": "CPU usage exceeded 90%"
}'Response (all ok):
{
"code": 0,
"message": "ok",
"results": [
{ "identity": "cmd-test", "ok": true, "detail": "group -> 123456789" }
]
}Response (partial failure):
{
"code": 0,
"message": "partial failure",
"results": [
{ "identity": "cmd-test", "ok": true, "detail": "group -> 123456789" },
{ "identity": "discord-bot", "ok": false, "detail": "identity \"discord-bot\" not found" }
]
}Response (invalid token):
{ "code": 2, "message": "invalid token" }Response (missing fields):
{ "code": 1, "message": "missing token / title / content" }GET
curl "http://127.0.0.1:720/maki?token=your-secret-token-here&title=Hello&content=World"GET method supports the same query parameters and returns the same response format.
Error Codes
| Code | Meaning |
|------|---------|
| 0 | Success (all targets or partial). |
| 1 | Missing required fields (token, title, or content). |
| 2 | Invalid token — no matching rule found. |
Check results[].ok in the response to see per-target status.
Commands (Admin Only)
These commands are only available to users with ADMIN access.
/maki list
View all configured rules by index number (tokens are hidden).
/maki list
→ 共 2 条规则:
→ #1 → targets: [cmd-test, qq-adapter]
→ #2 → targets: [discord-bot]/maki test <index:number> [title:string] [content:string]
Send a test message to all targets of a specific rule.
| Argument | Required | Default | Description |
|----------|----------|---------|-------------|
| index | Yes | - | Rule number (1-based, see /maki list). |
| title | No | 测试通知 | Title of the test message. |
| content | No | 这是一条测试消息 | Content of the test message. |
/maki test 1 "Alert" "Something happened!"
→ 测试消息已发送(规则 #1):
→ ✅ group -> 123456789
→ ✅ private -> abc123