/** * QQ Bot 配置类型 */ export interface QQBotConfig { appId: string; clientSecret?: string; clientSecretFile?: string; } /** * 解析后的 QQ Bot 账户 */ export interface ResolvedQQBotAccount { accountId: string; name?: string; enabled: boolean; appId: string; clientSecret: string; secretSource: "config" | "file" | "env" | "none"; /** 系统提示词 */ systemPrompt?: string; /** 图床服务器公网地址 */ imageServerBaseUrl?: string; /** 是否支持 markdown 消息(默认 false,需要机器人具备该权限才能启用) */ markdownSupport?: boolean; config: QQBotAccountConfig; } /** * QQ Bot 账户配置 */ export interface QQBotAccountConfig { enabled?: boolean; name?: string; appId?: string; clientSecret?: string; clientSecretFile?: string; dmPolicy?: "open" | "pairing" | "allowlist"; allowFrom?: string[]; /** 系统提示词,会添加在用户消息前面 */ systemPrompt?: string; /** 图床服务器公网地址,用于发送图片,例如 http://your-ip:18765 */ imageServerBaseUrl?: string; /** 是否支持 markdown 消息(默认 false,需要机器人具备该权限才能启用) */ markdownSupport?: boolean; } /** * 富媒体附件 */ export interface MessageAttachment { content_type: string; // 如 "image/png" filename?: string; height?: number; width?: number; size?: number; url: string; } /** * C2C 消息事件 */ export interface C2CMessageEvent { author: { id: string; union_openid: string; user_openid: string; }; content: string; id: string; timestamp: string; message_scene?: { source: string; }; attachments?: MessageAttachment[]; } /** * 频道 AT 消息事件 */ export interface GuildMessageEvent { id: string; channel_id: string; guild_id: string; content: string; timestamp: string; author: { id: string; username?: string; bot?: boolean; }; member?: { nick?: string; joined_at?: string; }; attachments?: MessageAttachment[]; } /** * 群聊 AT 消息事件 */ export interface GroupMessageEvent { author: { id: string; member_openid: string; }; content: string; id: string; timestamp: string; group_id: string; group_openid: string; attachments?: MessageAttachment[]; } /** * WebSocket 事件负载 */ export interface WSPayload { op: number; d?: unknown; s?: number; t?: string; }