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.mjs
CHANGED
|
@@ -832,7 +832,7 @@ function getLogFilePath(uin, platformName) {
|
|
|
832
832
|
|
|
833
833
|
//#endregion
|
|
834
834
|
//#region package.json
|
|
835
|
-
var version = "0.2.
|
|
835
|
+
var version = "0.2.3";
|
|
836
836
|
|
|
837
837
|
//#endregion
|
|
838
838
|
//#region src/actions.ts
|
|
@@ -1179,15 +1179,15 @@ async function enablePlugin(bot, plugin, type = "external") {
|
|
|
1179
1179
|
await Promise.all([...clears, ...userClears].map((fn) => fn?.()));
|
|
1180
1180
|
runtimePlugins.delete(name);
|
|
1181
1181
|
} catch (err) {
|
|
1182
|
-
throw new Error(
|
|
1182
|
+
throw new Error(`>>> 禁用插件 [${typeDesc}]${name}@${version$1} 失败: ${err?.message}`);
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
1185
|
});
|
|
1186
1186
|
const end = hrtime.bigint();
|
|
1187
1187
|
const time = Math.round(Number(end - start$1)) / 1e6;
|
|
1188
|
-
bot.logger.info(
|
|
1188
|
+
bot.logger.info(`>>> 启用插件 [${typeDesc}]${name}@${version$1} => 耗时 ${time} ms`);
|
|
1189
1189
|
} catch (e) {
|
|
1190
|
-
throw new Error(
|
|
1190
|
+
throw new Error(`>>> 启用插件 [${typeDesc}]${name}@${version$1} 失败: ${e?.message}`);
|
|
1191
1191
|
}
|
|
1192
1192
|
return plugin;
|
|
1193
1193
|
}
|
|
@@ -1622,13 +1622,16 @@ async function start(options = {}) {
|
|
|
1622
1622
|
process.title = `mioki v${version}`;
|
|
1623
1623
|
const logger = getMiokiLogger(botConfig.log_level || "info");
|
|
1624
1624
|
const plugin_dir = getAbsPluginDir();
|
|
1625
|
-
logger.info(`>>> mioki v${version}
|
|
1625
|
+
logger.info(`>>> mioki v${version} 启动中`);
|
|
1626
|
+
logger.info(`>>> 工作目录: ${BOT_CWD.value}`);
|
|
1627
|
+
logger.info(`>>> 插件目录: ${plugin_dir}`);
|
|
1626
1628
|
const napcat = new NapCat({
|
|
1627
1629
|
...botConfig.napcat,
|
|
1628
1630
|
logger
|
|
1629
1631
|
});
|
|
1630
1632
|
napcat.on("napcat.connected", async ({ uin }) => {
|
|
1631
|
-
logger.info(`>>> 已连接到 NapCat
|
|
1633
|
+
logger.info(`>>> 已连接到 NapCat 服务器`);
|
|
1634
|
+
logger.info(`>>> 当前登录 QQ 账号: ${uin}`);
|
|
1632
1635
|
let lastNoticeTime = 0;
|
|
1633
1636
|
process.on("uncaughtException", async (err) => {
|
|
1634
1637
|
napcat.logger.error(">>> uncaughtException, 出错了", err);
|
|
@@ -1688,17 +1691,14 @@ async function start(options = {}) {
|
|
|
1688
1691
|
try {
|
|
1689
1692
|
napcat.logger.info(`>>> 加载内置插件: ${BUILTIN_PLUGINS.map((p) => p.name).join(", ")}`);
|
|
1690
1693
|
await Promise.all(BUILTIN_PLUGINS.map((p) => enablePlugin(napcat, p, "builtin")));
|
|
1691
|
-
for (const [
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
}
|
|
1700
|
-
}));
|
|
1701
|
-
}
|
|
1694
|
+
for (const [_, plugins$1] of sortedGroups) await Promise.all(plugins$1.map(async (p) => {
|
|
1695
|
+
try {
|
|
1696
|
+
await enablePlugin(napcat, p, "external");
|
|
1697
|
+
} catch (e) {
|
|
1698
|
+
const err = stringifyError(e);
|
|
1699
|
+
failedEnablePlugins.push([p.name, err]);
|
|
1700
|
+
}
|
|
1701
|
+
}));
|
|
1702
1702
|
} catch (e) {
|
|
1703
1703
|
napcat.logger.error(e?.message);
|
|
1704
1704
|
noticeMainOwner(napcat, e?.message);
|