This commit is contained in:
eskima committed 2026-06-04 15:45:20 +08:00
commit 440f572834
53 files changed
+12776

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { z } from 'zod';
const accountSchema = z.object({
homeServer: z.string().url(),
userId: z.string().regex(/^@.+:.+$/, 'userId 必须是 @user:server 形式'),
password: z.string().min(1),
});
const botSchema = z.object({
name: z.string().min(1),
account: z.string().min(1),
rooms: z.array(z.string().regex(/^!.+:.+$/, 'roomId 必须是 !id:server 形式')).min(1),
config: z.record(z.any()).default({}),
});
export const rootConfigSchema = z.object({
accounts: z.record(accountSchema),
bots: z.array(botSchema),
});
export type AccountConfig = z.infer<typeof accountSchema>;
export type BotConfig = z.infer<typeof botSchema>;
export type RootConfig = z.infer<typeof rootConfigSchema>;