refactor: apiInit Refactor

This commit is contained in:
手瓜一十雪 committed 2024-11-14 10:52:03 +08:00
1 parent 56fac6c725
commit b9cadb20f7
4 files changed
+21 -13

No files matched your search

+7 -1
View File
@@ -120,7 +120,13 @@ export class NapCatCore {
if (!fs.existsSync(this.NapCatTempPath)) {
fs.mkdirSync(this.NapCatTempPath, { recursive: true });
}
//遍历this.apis[i].initApi 如果存在该函数进行async 调用
for (const apiKey in this.apis) {
const api = this.apis[apiKey as keyof StableNTApiWrapper];
if ('initApi' in api && typeof api.initApi === 'function') {
await api.initApi();
}
}
this.initNapCatCoreListeners().then().catch(this.context.logger.logError.bind(this.context.logger));
this.context.logger.setFileLogEnabled(