first commit

This commit is contained in:
sliverp
2026-01-28 17:18:41 +08:00
commit 9a531cd6eb
10 changed files with 778 additions and 0 deletions

81
src/types.ts Normal file
View File

@@ -0,0 +1,81 @@
/**
* 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";
config: QQBotAccountConfig;
}
/**
* QQ Bot 账户配置
*/
export interface QQBotAccountConfig {
enabled?: boolean;
name?: string;
appId?: string;
clientSecret?: string;
clientSecretFile?: string;
dmPolicy?: "open" | "pairing" | "allowlist";
allowFrom?: 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;
};
}
/**
* WebSocket 事件负载
*/
export interface WSPayload {
op: number;
d?: unknown;
s?: number;
t?: string;
}