← Catalog

pi-qq-connect

QQ 官方机器人 ⇄ 当前 Pi 会话:私聊/群聊、出站文件、后台常驻,聊天里只映射 /new(Linux)

Extension

Install

Install with PiG

pig install npm:pi-qq-connect

Install with Pi

pi install npm:pi-qq-connect
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.js"
  ]
}

README

Written by the package's publisher, shown as published in version 0.5.1 (README.md). PiG does not review it.

pi-qq-connect

npm license

Platform: Linux only. The background service is a systemd user unit (systemctl --user). macOS and Windows are neither tested nor supported.

Bridge the official QQ bot platform to the current Pi session. Messages sent in QQ reach your Pi session; the final answer is sent back as a passive reply. Zero runtime dependencies (Node built-ins only).

Features

  • Private chats and group @-mentions; images, voice transcripts, quoted messages, typing
  • Serial queue, deduplication, passive-reply budget, single-instance lock
  • Long replies split on code fences; failures retry with a fresh msg_seq
  • Outbound images/files via [[file:/absolute/path]] in a reply (max 3)
  • Session switches keep the gateway up; the next session instance adopts the bridge
  • Background service under systemd; startup is silent, errors carry a stable [QQ_E_*] code
  • In chat only /new is mapped; skills, prompt templates and other extensions still work

Requirements

  • A QQ bot on the official platform (appId + clientSecret)
  • Node.js >= 22.19
  • Pi >= 1.4
  • Linux with systemd (user units)

Install

pi install npm:pi-qq-connect
# or from a checkout
pi install .

Restart Pi after installing.

Configure

Create ~/.pi/agent/pi-qq-connect.json (mode 0600):

{
  "appId": "your-app-id",
  "clientSecret": "your-app-secret",
  "sandbox": false,
  "allowAll": true
}

See examples/config.json for every option. allowAll: true is fine for a personal bot; otherwise list allowUsers / allowGroups.

Commands

Terminal:

CommandPurpose
/qq statusgateway, queue, last inbound, service
/qq start / /qq stop [--force]manage the background service
/qq log [n]last n log lines (default 20)
/qq helpthis list
/qq loginvalidate appId/clientSecret, restart the service
/qq logoutstop the service, back up the config and remove clientSecret

In the QQ chat window only /new is mapped: send /new or /new name to start a new session. Control commands answer with a terminal hint. Skills, prompt templates and other extension commands are forwarded to Pi unchanged.

Background service

cp packaging/pi-qq-connect.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now pi-qq-connect

The plugin starts the service with systemctl --user start when a unit exists, and falls back to a detached process otherwise. Logs: journalctl --user -u pi-qq-connect -n 50.

Limits

  • Passive replies only: 4 per message in private chat (60 min window), 5 in groups
  • QQ drops the WebSocket after roughly 30 minutes of inactivity; the client reconnects
  • No Markdown rendering on the QQ side

License

MIT