MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / init

Method init

sticker/sticker.ts:28–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 private static db: any = null;
27 private static initialized = false;
28 private static configPath: string;
29
30 private static async init(): Promise<void> {
31 if (this.initialized) return;
32
33 try {
34 // 使用插件专用目录
35 this.configPath = resolvePluginAssetFile({
36 plugin: "sticker",
37 fileName: "config.json",
38 legacyDirs: ["sticker"],
39 legacyFiles: [{ dir: "sticker", fileName: "config.json" }],
40 });
41
42 // 以扁平结构初始化
43 this.db = await JSONFilePreset<Record<string, any>>(
44 this.configPath,
45 { ...DEFAULT_CONFIG }
46 );
47 this.initialized = true;
48 } catch (error) {
49 console.error("[sticker] 初始化配置失败:", error);
50 }

Callers 3

getMethod · 0.95
setMethod · 0.95
removeMethod · 0.95

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected