0.1.2 • Published 6 years ago
@ion-bot/receiver-cqhttp v0.1.2
@ion-bot/receiver-cqhttp
@ion-bot/receiver-cqhttp 是一个事件触发器,它建立一个 Koa 服务器并在接收到 cqhttp 上报消息时触发对应事件。
Introduction
@ion-bot/sender-cqhttp 是一个类库,因此你可以这样将其包含进你的项目中:
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
。