Files
qqbot/src/types.ts
sliverp b58146d9b8 11
2026-01-29 12:03:48 +08:00

101 lines
1.7 KiB
TypeScript

/**
* 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;
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;
}
/**
* C2C 消息事件
*/
export interface C2CMessageEvent {
author: {
id: string;
union_openid: string;
user_openid: string;
};
content: string;
id: string;
timestamp: string;
message_scene?: {
source: string;
};
}
/**
* 频道 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;
};
}
/**
* 群聊 AT 消息事件
*/
export interface GroupMessageEvent {
author: {
id: string;
member_openid: string;
};
content: string;
id: string;
timestamp: string;
group_id: string;
group_openid: string;
}
/**
* WebSocket 事件负载
*/
export interface WSPayload {
op: number;
d?: unknown;
s?: number;
t?: string;
}