feat(channels): QQ 非消息事件全枚举投递 + systemnotice 补 request/interaction/unknown 类
- 适配器不再整类丢弃:notice/request/meta_event/message_sent/未知 post_type/JSON 解析失败( decode_error ) 一律归一化投递并留痕
- notice 映射补 group_ban/sub_type 全枚举,未知类型走 NoticeUnknown 兜底(fail-safe 只登记、绝不猜、绝不放行)
- 不投影 flag/comment/file/duration;归一化 DEBUG 只记结构(脱敏,变异实测可打红)
- 传输层端到端已覆盖(真实 http+server 上报路径:加好友请求/心跳/未知类型)
- ⚠️ 主人 2026-10-05 决定「先不连 QQ」(风控)⇒ 本片为通用红线(绝不静默丢弃)+ 现成证据链,QQ 侧后续增量工作暂停
This commit is contained in:
1 parent
ec3f6e810a
commit
ba17820040
9 files changed
+1315
-193
No files matched your search
@@ -27,20 +27,46 @@ const (
|
||||
)
|
||||
|
||||
// OneBot v11 event as delivered over WebSocket.
|
||||
//
|
||||
// 字段集覆盖**全部四类** post_type(design/26 §3.1):message(message_type)、
|
||||
// notice(notice_type / sub_type)、request(request_type)、meta_event
|
||||
// (meta_event_type),外加 go-cqhttp 扩展的 message_sent。
|
||||
//
|
||||
// 刻意**不声明** `flag`(加好友 / 加群请求的可执行凭据)与 `comment`(验证信息):
|
||||
// 它们分别等同 token 与用户生成文本,design/26 §4.2 明令不得入库、不得进日志。
|
||||
// 不建字段,就没有任何一条路径能把它们带进结构化字段(要「自动同意」时再从内存载荷
|
||||
// 单次取用,绝不落库)。同理不声明 `file` / `sender.*` 里的头像等隐私字段,也不声明
|
||||
// `group_ban.duration`——它只说明时长,判定「全员禁言」用 `user_id == 0` 即足
|
||||
// (多投影一个用不到的数字,只会多一处可被误用的字段)。
|
||||
type obEvent struct {
|
||||
PostType string `json:"post_type"`
|
||||
MessageType string `json:"message_type"`
|
||||
NoticeType string `json:"notice_type"`
|
||||
Time int64 `json:"time"`
|
||||
SelfID int64 `json:"self_id"`
|
||||
MessageID int64 `json:"message_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
GroupID int64 `json:"group_id"`
|
||||
GroupName string `json:"group_name"`
|
||||
SubType string `json:"sub_type"`
|
||||
RawMessage string `json:"raw_message"`
|
||||
Message json.RawMessage `json:"message"`
|
||||
Sender *obSender `json:"sender"`
|
||||
PostType string `json:"post_type"`
|
||||
MessageType string `json:"message_type"`
|
||||
NoticeType string `json:"notice_type"`
|
||||
MetaEventType string `json:"meta_event_type"`
|
||||
RequestType string `json:"request_type"`
|
||||
Time int64 `json:"time"`
|
||||
SelfID int64 `json:"self_id"`
|
||||
MessageID int64 `json:"message_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
TargetID int64 `json:"target_id"`
|
||||
GroupID int64 `json:"group_id"`
|
||||
GroupName string `json:"group_name"`
|
||||
SubType string `json:"sub_type"`
|
||||
OperatorID int64 `json:"operator_id"`
|
||||
Echo string `json:"echo"`
|
||||
RawMessage string `json:"raw_message"`
|
||||
Message json.RawMessage `json:"message"`
|
||||
Sender *obSender `json:"sender"`
|
||||
}
|
||||
|
||||
// hitsSelf 报告该事件是否命中**她自己**(design/26 §2.2 的「self 命中升档」判据):
|
||||
// 发起者 / 被作用者 / 操作者任一等于 self_id 即算命中。判据全是**结构化 id**,
|
||||
// 与正文措辞无关,也绝不参与判主。
|
||||
func (ev *obEvent) hitsSelf() bool {
|
||||
if ev == nil || ev.SelfID == 0 {
|
||||
return false
|
||||
}
|
||||
return ev.UserID == ev.SelfID || ev.TargetID == ev.SelfID || ev.OperatorID == ev.SelfID
|
||||
}
|
||||
|
||||
// obSender is the sender identity carried by a message event.
|
||||
|
||||
Reference in new issue
Block a user