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 45fac267fe feat: 平台配置唯一ID — PlatformConfig.ID + adapter全链路传播
- PlatformConfig 新增 ID 字段 (8字节hex,创建时自动生成)
- QQ adapter 新增 configID + ConfigID() 访问器
- ChannelInfo 新增 AdapterID + AdapterName
- createSingleAdapter 接受 configID 参数
- 同一个平台类型的多个配置实例通过 ID 唯一区分

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-23 17:59:37 +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"`
}