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 efcd97e98f fix: TLS连接池复用 + 禁言检测 + 降级回复静默
- llm/openai.go: 移除DisableKeepAlives,启用连接池(100idle/20perhost/90s)
  修复频繁TLS握手超时问题
- qq/adapter.go: 监听group_ban通知,发送前检查禁言状态
  防止向被禁言群发消息导致风控
- cmd/main.go: 降级回复仅管理员私聊,群聊静默失败避免怪话
- protocol.go: OBv11Message新增Duration字段
- bridge/router.go: 处理noticeToUnified返回nil(内部消费的通知)
2026-07-02 20:31:08 +08:00

87 lines
3.0 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"`
Duration int64 `json:"duration"` // group_ban: mute duration in seconds (0 = indefinite)
// 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"`
}