41f653b672
- 所有对外称呼从 QQ 改为 OBv11(注释/提示词/日志/配置项) - 新增 PlatformFormat 结构体,统一管理平台消息标记格式 - defaultPlatformFormats() 注册表替代硬编码 qqTargetRe - extractProactiveMessage 改为 Thinker 方法,遍历格式注册表匹配 - 配置项重命名: QQ_BOT_PORT → OBV11_BOT_PORT, QQBotPort → OBv11BotPort - 标记格式: 【QQ群聊】→【OBv11群聊】、【QQ私聊】→【OBv11私聊】 Co-Authored-By: Claude <noreply@anthropic.com>
31 lines
923 B
Go
31 lines
923 B
Go
package bridge
|
|
|
|
import "context"
|
|
|
|
// PlatformAdapter is the interface every platform adapter must implement.
|
|
type PlatformAdapter interface {
|
|
PlatformName() string
|
|
|
|
// Message conversion.
|
|
ToUnified(rawMessage interface{}) (*UnifiedMessage, error)
|
|
FromUnified(response *UnifiedResponse) ([]PlatformMessage, error)
|
|
|
|
// Capabilities.
|
|
Capabilities() PlatformCapabilities
|
|
|
|
// Connection management.
|
|
Connect(ctx context.Context) error
|
|
Disconnect(ctx context.Context) error
|
|
IsConnected() bool
|
|
HealthCheck() error
|
|
}
|
|
|
|
// ProactiveSender is an optional interface for adapters that can
|
|
// proactively send messages (e.g., OBv11 bot sending without prior request).
|
|
type ProactiveSender interface {
|
|
SendProactive(chatType string, userID, groupID int64, content string) error
|
|
}
|
|
|
|
// MessageHandler receives unified messages from adapters for processing.
|
|
type MessageHandler func(msg *UnifiedMessage) (*UnifiedResponse, error)
|