mioki 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +17 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +17 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -883,7 +883,7 @@ function getLogFilePath(uin, platformName) {
|
|
|
883
883
|
|
|
884
884
|
//#endregion
|
|
885
885
|
//#region package.json
|
|
886
|
-
var version = "0.2.
|
|
886
|
+
var version = "0.2.3";
|
|
887
887
|
|
|
888
888
|
//#endregion
|
|
889
889
|
//#region src/actions.ts
|
|
@@ -1230,15 +1230,15 @@ async function enablePlugin(bot, plugin, type = "external") {
|
|
|
1230
1230
|
await Promise.all([...clears, ...userClears].map((fn) => fn?.()));
|
|
1231
1231
|
runtimePlugins.delete(name);
|
|
1232
1232
|
} catch (err) {
|
|
1233
|
-
throw new Error(
|
|
1233
|
+
throw new Error(`>>> 禁用插件 [${typeDesc}]${name}@${version$1} 失败: ${err?.message}`);
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
1236
|
});
|
|
1237
1237
|
const end = node_process.hrtime.bigint();
|
|
1238
1238
|
const time = Math.round(Number(end - start$1)) / 1e6;
|
|
1239
|
-
bot.logger.info(
|
|
1239
|
+
bot.logger.info(`>>> 启用插件 [${typeDesc}]${name}@${version$1} => 耗时 ${time} ms`);
|
|
1240
1240
|
} catch (e) {
|
|
1241
|
-
throw new Error(
|
|
1241
|
+
throw new Error(`>>> 启用插件 [${typeDesc}]${name}@${version$1} 失败: ${e?.message}`);
|
|
1242
1242
|
}
|
|
1243
1243
|
return plugin;
|
|
1244
1244
|
}
|
|
@@ -1673,13 +1673,16 @@ async function start(options = {}) {
|
|
|
1673
1673
|
process.title = `mioki v${version}`;
|
|
1674
1674
|
const logger = getMiokiLogger(botConfig.log_level || "info");
|
|
1675
1675
|
const plugin_dir = getAbsPluginDir();
|
|
1676
|
-
logger.info(`>>> mioki v${version}
|
|
1676
|
+
logger.info(`>>> mioki v${version} 启动中`);
|
|
1677
|
+
logger.info(`>>> 工作目录: ${BOT_CWD.value}`);
|
|
1678
|
+
logger.info(`>>> 插件目录: ${plugin_dir}`);
|
|
1677
1679
|
const napcat = new napcat_sdk.NapCat({
|
|
1678
1680
|
...botConfig.napcat,
|
|
1679
1681
|
logger
|
|
1680
1682
|
});
|
|
1681
1683
|
napcat.on("napcat.connected", async ({ uin }) => {
|
|
1682
|
-
logger.info(`>>> 已连接到 NapCat
|
|
1684
|
+
logger.info(`>>> 已连接到 NapCat 服务器`);
|
|
1685
|
+
logger.info(`>>> 当前登录 QQ 账号: ${uin}`);
|
|
1683
1686
|
let lastNoticeTime = 0;
|
|
1684
1687
|
process.on("uncaughtException", async (err) => {
|
|
1685
1688
|
napcat.logger.error(">>> uncaughtException, 出错了", err);
|
|
@@ -1739,17 +1742,14 @@ async function start(options = {}) {
|
|
|
1739
1742
|
try {
|
|
1740
1743
|
napcat.logger.info(`>>> 加载内置插件: ${BUILTIN_PLUGINS.map((p) => p.name).join(", ")}`);
|
|
1741
1744
|
await Promise.all(BUILTIN_PLUGINS.map((p) => enablePlugin(napcat, p, "builtin")));
|
|
1742
|
-
for (const [
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
}
|
|
1751
|
-
}));
|
|
1752
|
-
}
|
|
1745
|
+
for (const [_, plugins$1] of sortedGroups) await Promise.all(plugins$1.map(async (p) => {
|
|
1746
|
+
try {
|
|
1747
|
+
await enablePlugin(napcat, p, "external");
|
|
1748
|
+
} catch (e) {
|
|
1749
|
+
const err = stringifyError(e);
|
|
1750
|
+
failedEnablePlugins.push([p.name, err]);
|
|
1751
|
+
}
|
|
1752
|
+
}));
|
|
1753
1753
|
} catch (e) {
|
|
1754
1754
|
napcat.logger.error(e?.message);
|
|
1755
1755
|
noticeMainOwner(napcat, e?.message);
|