This repository has been archived on 2026-08-12. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Cyrene/backend/platform-bridge/internal/adapter/qq/protocol.go
T
AskaEth cadd5f2233 feat: QQ主动消息管道 + 戳一戳事件 + thinker提示词优化
- ProactiveTarget 结构体 + QQ目标正则解析(extractProactiveMessage 返回双值)
- storeThought 双路推送:platform消息 → platformMessagePusher,web消息 → messagePusher
- platform-bridge: SendProactive接口 + ProactiveSender + /api/v1/internal/send-proactive端点
- QQ戳一戳/notice事件 → noticeToUnified → ContentType "action"
- thinker提示词注入QQ频道上下文:群名称(群号)、活跃时间、trigger-aware引导
- SetBotUID/SetPlatformMessagePusher/AddOrUpdatePlatformChannel 方法
- ai-core source 增加 BotUID/GroupName,platform-bridge source 增加 bot_uid/group_name
- 支持 [CQ:at,qq=xxx] @提及标签自动拼接

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-22 20:26:36 +08:00

86 lines
2.9 KiB
Go

package qq
// OBv11 (OneBot v11) protocol types.
// OBv11Message is a message received from QQ via OneBot.
type OBv11Message struct {
PostType string `json:"post_type"` // "message", "notice", "request"
MessageType string `json:"message_type"` // "private", "group"
Time int64 `json:"time"`
SelfID int64 `json:"self_id"`
// Private message fields.
Sender *OBv11Sender `json:"sender,omitempty"`
Message interface{} `json:"message"` // string or []OBv11MessageSegment
RawMessage string `json:"raw_message"`
Font int `json:"font"`
SubType string `json:"sub_type"` // "friend", "group", "other"
MessageID int32 `json:"message_id"`
UserID int64 `json:"user_id"`
TargetID int64 `json:"target_id"`
TempSource int `json:"temp_source"`
// Group message fields.
GroupID int64 `json:"group_id"`
Anonymous interface{} `json:"anonymous"`
MessageSeq int64 `json:"message_seq"`
// Notice fields.
NoticeType string `json:"notice_type"`
// Poke detail (sub_type === "poke").
PokeDetail *OBv11PokeDetail `json:"poke_detail,omitempty"`
}
// OBv11PokeDetail contains extra info for poke ("戳一戳") notice events.
type OBv11PokeDetail struct {
Action string `json:"action"` // e.g. "戳了戳"
Suffix string `json:"suffix"` // e.g. "你的脸蛋"
PokePic string `json:"poke_pic"` // e.g. "https://..."
}
// OBv11Sender represents a message sender.
type OBv11Sender struct {
UserID int64 `json:"user_id"`
Nickname string `json:"nickname"`
Sex string `json:"sex"`
Age int32 `json:"age"`
Card string `json:"card"` // group card (nickname in group)
Area string `json:"area"`
Level string `json:"level"`
Role string `json:"role"` // "owner", "admin", "member"
Title string `json:"title"`
}
// OBv11MessageSegment is a segment in an array-format message.
type OBv11MessageSegment struct {
Type string `json:"type"`
Data map[string]interface{} `json:"data"`
}
// OBv11APIResponse is the response from an API call.
type OBv11APIResponse struct {
Status string `json:"status"` // "ok" or "failed"
RetCode int `json:"retcode"`
Data interface{} `json:"data"`
Message string `json:"msg"`
Wording string `json:"wording"`
Echo string `json:"echo"`
}
// OBv11SendMsg is the request body for send_msg.
type OBv11SendMsg struct {
Action string `json:"action"`
Params OBv11Params `json:"params"`
Echo string `json:"echo,omitempty"`
}
// OBv11Params holds parameters for send_msg API calls.
type OBv11Params struct {
MessageType string `json:"message_type,omitempty"` // "private", "group"
UserID int64 `json:"user_id,omitempty"`
GroupID int64 `json:"group_id,omitempty"`
Message interface{} `json:"message"`
AutoEscape bool `json:"auto_escape,omitempty"`
}