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

Method initDatabase

autodel/autodel.ts:65–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 }
64
65 private async initDatabase(): Promise<void> {
66 try {
67 const assetsDir = await createDirectoryInAssets("autodel");
68 const dbPath = path.join(assetsDir, "autodel.db");
69
70 this.db = new Database(dbPath);
71
72 this.db.exec(`
73 CREATE TABLE IF NOT EXISTS autodel_settings (
74 chat_id TEXT PRIMARY KEY,
75 seconds INTEGER NOT NULL
76 )
77 `);
78
79 await this.loadExistingSettings();
80 } catch (error) {
81 console.error("Failed to initialize autodel database:", error);
82 }
83 }
84
85 private async loadExistingSettings(): Promise<void> {
86 if (!this.db) return;

Callers 2

setupMethod · 0.95
constructorMethod · 0.95

Calls 3

loadExistingSettingsMethod · 0.95
execMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected