Receive messages from cqhttp, based on Koa.
npm install @ion-bot/receiver-cqhttp



!GitHub code size in bytes
@ion-bot/receiver-cqhttp 是一个事件触发器,它建立一个 Koa 服务器并在接收到 cqhttp 上报消息时触发对应事件。
js
import Receiver from '@ion-bot/receiver-cqhttp'
const receiverPort = 8080
const receiver = new Receiver(receiverPort)
receiver.on(eventName, () => { / Do Something / })
`Events
以下是所有可用的事件列表:|Event Name |Description |
|----------------------------|-----------------------------------|
|
'post' |上报即触发 |
|'message' |当 post_type 为 message 时触发 |
|'request' |当 post_type 为 request 时触发 |
|'notice' |当 post_type 为 notice 时触发 |
|'message/${message_type}' |当 post_type 为 message 时触发,细分到 message_type 类别 |
|'request/${request_type}' |当 post_type 为 request 时触发,细分到 request_type 类别 |
|'notice/${notice_type}' |当 post_type 为 notice 时触发,细分到 notice_type 类别 |> 请注意使用 legacy cqhttp 3 会导致事件
notice 变为事件 event`。