feat: 支持主动发送消息和附件处理

新增 `sendProactiveC2CMessage` 和 `sendProactiveGroupMessage` API,支持无需 msg_id 的主动消息发送(有月限额)。在网关中增加附件处理逻辑,支持解析图片和普通附件,并将附件信息传递给上下文。同时优化了 `sendText` 的目标地址解析逻辑,支持 `group:` 和 `channel:` 前缀,并新增 `sendProactiveMessage` 方法。
This commit is contained in:
sliverp
2026-01-29 16:17:06 +08:00
parent af31a001e9
commit 869519de7c
4 changed files with 170 additions and 10 deletions

View File

@@ -37,6 +37,18 @@ export interface QQBotAccountConfig {
systemPrompt?: string;
}
/**
* 富媒体附件
*/
export interface MessageAttachment {
content_type: string; // 如 "image/png"
filename?: string;
height?: number;
width?: number;
size?: number;
url: string;
}
/**
* C2C 消息事件
*/
@@ -52,6 +64,7 @@ export interface C2CMessageEvent {
message_scene?: {
source: string;
};
attachments?: MessageAttachment[];
}
/**
@@ -72,6 +85,7 @@ export interface GuildMessageEvent {
nick?: string;
joined_at?: string;
};
attachments?: MessageAttachment[];
}
/**
@@ -87,6 +101,7 @@ export interface GroupMessageEvent {
timestamp: string;
group_id: string;
group_openid: string;
attachments?: MessageAttachment[];
}
/**