Skip to content

This document was written by AI and has been manually reviewed.

KOOK (开黑啦)

The KOOK driver uses khl-py to connect via WebSocket (bot mode). It receives TEXT and KMarkdown messages from public text channels and sends using the KOOK bot API.

Setup

  1. Go to the KOOK developer portal and create a bot application.
  2. Under 机器人机器人连接方式, select WebSocket.
  3. Copy the bot token.
  4. Invite the bot to your server and give it permission to read and send messages in the target channel.
  5. Get the channel ID (right-click the channel → Copy ID, or from the channel URL).

Config keys

Add under kook.<instance_id> in config.json:

KeyRequiredDefaultDescription
tokenYesBot token from the KOOK developer portal
max_file_sizeNo26214400 (25 MB)Maximum bytes per attachment when uploading
proxyNoProxy URL for all Kook API requests (e.g., http://proxy.example.com:8080 or socks5://proxy.example.com:1080). Set to null to explicitly disable proxy for this instance (ignores global proxy setting).
json
{
  "kook": {
    "kook_main": {
      "token": "your-kook-bot-token",
      "max_file_size": 26214400
    }
  }
}

Rule channel keys

Use under channels or from/to in rules.json:

KeyDescription
channel_idKOOK text channel ID
json
{
  "kook_main": { "channel_id": "1234567890123456" }
}

Received message types

TEXT and KMarkdown messages from public text channels are bridged. The raw message content (including any KMarkdown syntax) is passed through as the message text.

Sending

Attachment typeSent as
imageUploaded to KOOK CDN; embedded with (img)url(img) KMarkdown syntax
voice / video / fileUploaded to KOOK CDN; sent as a [filename](url) hyperlink

When the message contains images or a rich header, the message is sent as KMarkdown type so formatting renders correctly. Plain text messages with no attachments are sent as TEXT type.

Notes

  • The bot must be in the target server before NextBridge starts.
  • Incoming KMarkdown messages are forwarded as-is. Other platforms may see raw KMarkdown syntax (e.g. **bold**) as plain text.
  • The KOOK WebSocket connection reconnects automatically if the khl-py library handles it internally.