mioki 0.4.2 → 0.5.0
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 +94 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -8
- package/dist/index.d.mts +10 -8
- package/dist/index.mjs +71 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -59,9 +59,9 @@ let dayjs = require("dayjs");
|
|
|
59
59
|
dayjs = __toESM(dayjs);
|
|
60
60
|
let dedent = require("dedent");
|
|
61
61
|
dedent = __toESM(dedent);
|
|
62
|
+
let consola_utils = require("consola/utils");
|
|
62
63
|
let systeminformation = require("systeminformation");
|
|
63
64
|
systeminformation = __toESM(systeminformation);
|
|
64
|
-
let consola_utils = require("consola/utils");
|
|
65
65
|
let consola_core = require("consola/core");
|
|
66
66
|
let node_process = require("node:process");
|
|
67
67
|
let node_os = require("node:os");
|
|
@@ -77,7 +77,10 @@ var utils_exports = /* @__PURE__ */ __export({
|
|
|
77
77
|
START_TIME: () => START_TIME,
|
|
78
78
|
base64Decode: () => base64Decode,
|
|
79
79
|
base64Encode: () => base64Encode,
|
|
80
|
+
box: () => consola_utils.box,
|
|
80
81
|
clamp: () => clamp,
|
|
82
|
+
colorize: () => consola_utils.colorize,
|
|
83
|
+
colors: () => consola_utils.colors,
|
|
81
84
|
createCmd: () => createCmd,
|
|
82
85
|
createDB: () => createDB,
|
|
83
86
|
createStore: () => createStore,
|
|
@@ -133,6 +136,7 @@ var utils_exports = /* @__PURE__ */ __export({
|
|
|
133
136
|
runWithReaction: () => runWithReaction,
|
|
134
137
|
string2argv: () => string2argv.string2argv,
|
|
135
138
|
stringifyError: () => stringifyError,
|
|
139
|
+
stripAnsi: () => consola_utils.stripAnsi,
|
|
136
140
|
systemInfo: () => systeminformation.default,
|
|
137
141
|
text: () => text,
|
|
138
142
|
toArray: () => toArray,
|
|
@@ -503,7 +507,7 @@ async function getQuoteMessage(event, timeout = 3e3) {
|
|
|
503
507
|
resolve(cacheMsg$1);
|
|
504
508
|
} else if (Date.now() - start$1 > timeout) {
|
|
505
509
|
clearInterval(timer);
|
|
506
|
-
throw new Error(
|
|
510
|
+
throw new Error(`获取引用消息超时 ${timeout}, Key: ${key}`);
|
|
507
511
|
}
|
|
508
512
|
}, 100);
|
|
509
513
|
});
|
|
@@ -778,7 +782,6 @@ const START_TIME = /* @__PURE__ */ new Date();
|
|
|
778
782
|
var config_exports = /* @__PURE__ */ __export({
|
|
779
783
|
BOT_CWD: () => BOT_CWD,
|
|
780
784
|
botConfig: () => botConfig,
|
|
781
|
-
getLogFilePath: () => getLogFilePath$1,
|
|
782
785
|
hasRight: () => hasRight,
|
|
783
786
|
isAdmin: () => isAdmin,
|
|
784
787
|
isInPm2: () => isInPm2,
|
|
@@ -821,14 +824,14 @@ const updateBotConfig = async (draftFn) => {
|
|
|
821
824
|
const pkg = readPackageJson();
|
|
822
825
|
pkg.mioki = structuredClone(botConfig);
|
|
823
826
|
writePackageJson(pkg);
|
|
824
|
-
|
|
827
|
+
logger.info(`检测到配置变动,已同步至 package.json 文件`);
|
|
825
828
|
};
|
|
826
829
|
/**
|
|
827
830
|
* 更新机器人根目录
|
|
828
831
|
*/
|
|
829
832
|
const updateBotCWD = (root) => {
|
|
830
833
|
BOT_CWD.value = root;
|
|
831
|
-
|
|
834
|
+
logger.info(`机器人根目录已设置为 ${root}`);
|
|
832
835
|
};
|
|
833
836
|
/**
|
|
834
837
|
* 是否是主人
|
|
@@ -860,13 +863,6 @@ const hasRight = (id) => {
|
|
|
860
863
|
* 是否在 PM2 中运行
|
|
861
864
|
*/
|
|
862
865
|
const isInPm2 = Boolean("pm_id" in process.env || "PM2_USAGE" in process.env);
|
|
863
|
-
/**
|
|
864
|
-
* 获取日志文件名
|
|
865
|
-
*/
|
|
866
|
-
function getLogFilePath$1(uin, platformName) {
|
|
867
|
-
const startTime = (0, dayjs.default)().format("YYYY-MM-DD_HH-mm-ss");
|
|
868
|
-
return node_path.default.join(BOT_CWD.value, `logs/${uin}_${platformName}_${startTime}.log`);
|
|
869
|
-
}
|
|
870
866
|
|
|
871
867
|
//#endregion
|
|
872
868
|
//#region src/logger.ts
|
|
@@ -896,6 +892,7 @@ const LEVEL_MAP = {
|
|
|
896
892
|
color: "gray"
|
|
897
893
|
}
|
|
898
894
|
};
|
|
895
|
+
const logger = getMiokiLogger(botConfig.log_level || "info");
|
|
899
896
|
/**
|
|
900
897
|
* 获取日志文件名
|
|
901
898
|
*/
|
|
@@ -903,7 +900,7 @@ function getLogFilePath(type = "") {
|
|
|
903
900
|
const startTime = (0, dayjs.default)().format("YYYY-MM-DD_HH-mm-ss");
|
|
904
901
|
return node_path.default.join(BOT_CWD.value, `logs/${startTime}${type ? "." + type : ""}.log`);
|
|
905
902
|
}
|
|
906
|
-
|
|
903
|
+
function getMiokiLogger(level) {
|
|
907
904
|
const logDir = node_path.default.join(BOT_CWD.value, "logs");
|
|
908
905
|
if (!node_fs.default.existsSync(logDir)) node_fs.default.mkdirSync(logDir, { recursive: true });
|
|
909
906
|
const logFile = getLogFilePath();
|
|
@@ -927,11 +924,11 @@ const getMiokiLogger = (level) => {
|
|
|
927
924
|
date: true
|
|
928
925
|
}
|
|
929
926
|
});
|
|
930
|
-
}
|
|
927
|
+
}
|
|
931
928
|
|
|
932
929
|
//#endregion
|
|
933
930
|
//#region package.json
|
|
934
|
-
var version = "0.
|
|
931
|
+
var version = "0.5.0";
|
|
935
932
|
|
|
936
933
|
//#endregion
|
|
937
934
|
//#region src/actions.ts
|
|
@@ -954,11 +951,11 @@ var actions_exports = /* @__PURE__ */ __export({
|
|
|
954
951
|
*/
|
|
955
952
|
async function noticeGroups(bot, groupIdList, message, delay = 1e3) {
|
|
956
953
|
if (!bot.isOnline()) {
|
|
957
|
-
|
|
954
|
+
logger.error("发送失败,Bot 不在线");
|
|
958
955
|
return;
|
|
959
956
|
}
|
|
960
957
|
if (!message) {
|
|
961
|
-
|
|
958
|
+
logger.warn("消息内容为空");
|
|
962
959
|
return;
|
|
963
960
|
}
|
|
964
961
|
for (const groupId of groupIdList) {
|
|
@@ -973,11 +970,11 @@ async function noticeGroups(bot, groupIdList, message, delay = 1e3) {
|
|
|
973
970
|
*/
|
|
974
971
|
async function noticeFriends(bot, friendIdList, message, delay = 1e3) {
|
|
975
972
|
if (!bot.isOnline) {
|
|
976
|
-
|
|
973
|
+
logger.error("发送失败,Bot 不在线");
|
|
977
974
|
return;
|
|
978
975
|
}
|
|
979
976
|
if (!message) {
|
|
980
|
-
|
|
977
|
+
logger.warn("消息内容为空");
|
|
981
978
|
return;
|
|
982
979
|
}
|
|
983
980
|
for (const friendId of friendIdList) {
|
|
@@ -1004,11 +1001,11 @@ async function noticeOwners(bot, message, delay = 1e3) {
|
|
|
1004
1001
|
*/
|
|
1005
1002
|
async function noticeMainOwner(bot, message) {
|
|
1006
1003
|
if (!bot.isOnline()) {
|
|
1007
|
-
|
|
1004
|
+
logger.error("发送失败,Bot 不在线");
|
|
1008
1005
|
return;
|
|
1009
1006
|
}
|
|
1010
1007
|
if (!message) {
|
|
1011
|
-
|
|
1008
|
+
logger.warn("消息内容为空");
|
|
1012
1009
|
return;
|
|
1013
1010
|
}
|
|
1014
1011
|
const mainOwner = botConfig.owners[0];
|
|
@@ -1059,7 +1056,7 @@ async function runWithErrorHandler(bot, fn, event, message = (err) => `报...报
|
|
|
1059
1056
|
else try {
|
|
1060
1057
|
await noticeMainOwner(bot, "发送失败,可能被风控,请检查签名状态。");
|
|
1061
1058
|
} catch {
|
|
1062
|
-
|
|
1059
|
+
logger.error("发送失败,可能被风控,请检查签名状态。");
|
|
1063
1060
|
}
|
|
1064
1061
|
}
|
|
1065
1062
|
}
|
|
@@ -1239,7 +1236,7 @@ async function enablePlugin(bot, plugin, type = "external") {
|
|
|
1239
1236
|
const start$1 = node_process.hrtime.bigint();
|
|
1240
1237
|
const clears = /* @__PURE__ */ new Set();
|
|
1241
1238
|
const userClears = /* @__PURE__ */ new Set();
|
|
1242
|
-
const logger = bot.logger.withDefaults({
|
|
1239
|
+
const logger$1 = bot.logger.withDefaults({
|
|
1243
1240
|
tag: `plugin:${name}`,
|
|
1244
1241
|
args: [name]
|
|
1245
1242
|
});
|
|
@@ -1250,33 +1247,33 @@ async function enablePlugin(bot, plugin, type = "external") {
|
|
|
1250
1247
|
...utils_exports,
|
|
1251
1248
|
...config_exports,
|
|
1252
1249
|
...buildRemovedActions(bot),
|
|
1253
|
-
logger,
|
|
1250
|
+
logger: logger$1,
|
|
1254
1251
|
services,
|
|
1255
1252
|
clears: userClears,
|
|
1256
1253
|
addService: (name$1, service, cover) => {
|
|
1257
|
-
logger.debug(`Adding service: ${name$1} (cover: ${cover ? "yes" : "no"})`);
|
|
1254
|
+
logger$1.debug(`Adding service: ${name$1} (cover: ${cover ? "yes" : "no"})`);
|
|
1258
1255
|
const removeService = () => {
|
|
1259
|
-
logger.debug(`Removing service: ${name$1}`);
|
|
1256
|
+
logger$1.debug(`Removing service: ${name$1}`);
|
|
1260
1257
|
addService(name$1, service, cover);
|
|
1261
1258
|
};
|
|
1262
1259
|
clears.add(removeService);
|
|
1263
1260
|
return removeService;
|
|
1264
1261
|
},
|
|
1265
1262
|
handle: (eventName, handler) => {
|
|
1266
|
-
logger.debug(`Registering event handler for event: ${String(eventName)}`);
|
|
1263
|
+
logger$1.debug(`Registering event handler for event: ${String(eventName)}`);
|
|
1267
1264
|
bot.on(eventName, handler);
|
|
1268
1265
|
const unsubscribe = () => {
|
|
1269
|
-
logger.debug(`Unregistering event handler for event: ${String(eventName)}`);
|
|
1266
|
+
logger$1.debug(`Unregistering event handler for event: ${String(eventName)}`);
|
|
1270
1267
|
bot.off(eventName, handler);
|
|
1271
1268
|
};
|
|
1272
1269
|
clears.add(unsubscribe);
|
|
1273
1270
|
return unsubscribe;
|
|
1274
1271
|
},
|
|
1275
1272
|
cron: (cronExpression, handler) => {
|
|
1276
|
-
logger.debug(`Scheduling cron job: ${cronExpression}`);
|
|
1273
|
+
logger$1.debug(`Scheduling cron job: ${cronExpression}`);
|
|
1277
1274
|
const job = node_cron.default.schedule(cronExpression, (now) => handler(context, now));
|
|
1278
1275
|
const clear = () => {
|
|
1279
|
-
logger.debug(`Stopping cron job: ${cronExpression}`);
|
|
1276
|
+
logger$1.debug(`Stopping cron job: ${cronExpression}`);
|
|
1280
1277
|
job.stop();
|
|
1281
1278
|
};
|
|
1282
1279
|
clears.add(clear);
|
|
@@ -1292,19 +1289,19 @@ async function enablePlugin(bot, plugin, type = "external") {
|
|
|
1292
1289
|
plugin,
|
|
1293
1290
|
disable: async () => {
|
|
1294
1291
|
try {
|
|
1295
|
-
logger.debug(`Disabling plugin [${typeDesc}]${name}@${version$1}`);
|
|
1292
|
+
logger$1.debug(`Disabling plugin [${typeDesc}]${name}@${version$1}`);
|
|
1296
1293
|
await Promise.all([...clears, ...userClears].map((fn) => fn?.()));
|
|
1297
1294
|
runtimePlugins.delete(name);
|
|
1298
1295
|
} catch (err) {
|
|
1299
|
-
throw new Error(
|
|
1296
|
+
throw new Error(`禁用插件 [${consola_utils.colors.yellow(typeDesc)}]${consola_utils.colors.yellow(`${name}@${version$1}`)} 失败: ${err?.message}`);
|
|
1300
1297
|
}
|
|
1301
1298
|
}
|
|
1302
1299
|
});
|
|
1303
1300
|
const end = node_process.hrtime.bigint();
|
|
1304
1301
|
const time = Math.round(Number(end - start$1)) / 1e6;
|
|
1305
|
-
bot.logger.info(
|
|
1302
|
+
bot.logger.info(`启用插件 ${consola_utils.colors.yellow(`[${typeDesc}]`)}${consola_utils.colors.yellow(`${name}@${version$1}`)} => 耗时 ${consola_utils.colors.green(time.toFixed(2))} ms`);
|
|
1306
1303
|
} catch (e) {
|
|
1307
|
-
throw new Error(
|
|
1304
|
+
throw new Error(`启用插件 ${consola_utils.colors.yellow(`[${typeDesc}]`)}${consola_utils.colors.yellow(`${name}@${version$1}`)} 失败: ${e?.message}`);
|
|
1308
1305
|
}
|
|
1309
1306
|
return plugin;
|
|
1310
1307
|
}
|
|
@@ -1737,40 +1734,52 @@ async function start(options = {}) {
|
|
|
1737
1734
|
const { cwd = process.cwd() } = options;
|
|
1738
1735
|
if (cwd !== BOT_CWD.value) updateBotCWD(cwd);
|
|
1739
1736
|
process.title = `mioki v${version}`;
|
|
1740
|
-
const logger = getMiokiLogger(botConfig.log_level || "info");
|
|
1741
1737
|
const plugin_dir = getAbsPluginDir();
|
|
1742
|
-
logger.info(
|
|
1743
|
-
logger.info(
|
|
1744
|
-
logger.info(
|
|
1745
|
-
logger.info(
|
|
1746
|
-
logger.info(
|
|
1747
|
-
logger.info(
|
|
1748
|
-
logger.info(
|
|
1749
|
-
logger.info(
|
|
1738
|
+
logger.info(consola_utils.colors.dim("=".repeat(40)));
|
|
1739
|
+
logger.info(`欢迎使用 ${consola_utils.colors.bold(consola_utils.colors.cyan("mioki"))} ${consola_utils.colors.bold(consola_utils.colors.green(`v${version}`))}`);
|
|
1740
|
+
logger.info(consola_utils.colors.yellow(consola_utils.colors.underline(`一个基于 NapCat 和 TypeScript 的QQ 机器人框架`)));
|
|
1741
|
+
logger.info(consola_utils.colors.cyan(`轻量 * 跨平台 * 体验 * 热重载 * 继承 KiviBot`));
|
|
1742
|
+
logger.info(consola_utils.colors.dim("=".repeat(40)));
|
|
1743
|
+
logger.info(consola_utils.colors.dim(consola_utils.colors.italic(`作者: Viki <hi@viki.moe> (https://github.com/vikiboss)`)));
|
|
1744
|
+
logger.info(consola_utils.colors.dim(consola_utils.colors.italic(`仓库: https://github.com/vikiboss/mioki`)));
|
|
1745
|
+
logger.info(consola_utils.colors.dim(consola_utils.colors.italic(`文档: https://mioki.viki.moe/docs`)));
|
|
1746
|
+
logger.info(consola_utils.colors.dim("=".repeat(40)));
|
|
1747
|
+
logger.info(`${consola_utils.colors.dim("工作目录: ")}${consola_utils.colors.blue(BOT_CWD.value)}`);
|
|
1748
|
+
logger.info(`${consola_utils.colors.dim("插件目录: ")}${consola_utils.colors.blue(plugin_dir)}`);
|
|
1749
|
+
logger.info(`${consola_utils.colors.dim("配置文件: ")}${consola_utils.colors.blue(`${BOT_CWD.value}/package.json`)}`);
|
|
1750
|
+
logger.info(consola_utils.colors.dim("=".repeat(40)));
|
|
1751
|
+
const { protocol = "ws", port = 6700, host = "localhost", token } = botConfig.napcat || {};
|
|
1752
|
+
logger.info(`开始连接 NapCat 实例: ${consola_utils.colors.green(`${protocol}://${host}:${port}`)}`);
|
|
1750
1753
|
const napcat = new napcat_sdk.NapCat({
|
|
1751
|
-
|
|
1754
|
+
token,
|
|
1755
|
+
protocol,
|
|
1756
|
+
host,
|
|
1757
|
+
port,
|
|
1752
1758
|
logger
|
|
1753
1759
|
});
|
|
1754
|
-
napcat.on("
|
|
1755
|
-
logger.
|
|
1760
|
+
napcat.on("ws.close", () => {
|
|
1761
|
+
logger.error("连接已关闭,请确保 NapCat 实例正常运行及 token 配置正确");
|
|
1762
|
+
});
|
|
1763
|
+
napcat.on("napcat.connected", async ({ user_id, nickname, app_name, app_version }) => {
|
|
1764
|
+
logger.info(`已连接到 NapCat 实例: ${consola_utils.colors.green(`${app_name}-v${app_version}-${nickname}(${user_id})`)}`);
|
|
1756
1765
|
let lastNoticeTime = 0;
|
|
1757
1766
|
process.on("uncaughtException", async (err) => {
|
|
1758
1767
|
const msg = stringifyError(err);
|
|
1759
|
-
napcat.logger.error(
|
|
1768
|
+
napcat.logger.error(`uncaughtException, 出错了: ${msg}`);
|
|
1760
1769
|
if (Date.now() - lastNoticeTime < 1e3) return;
|
|
1761
1770
|
lastNoticeTime = Date.now();
|
|
1762
1771
|
await noticeMainOwner(napcat, `mioki 发生未捕获异常:\n\n${msg}`).catch(() => {
|
|
1763
|
-
napcat.logger.error("
|
|
1772
|
+
napcat.logger.error("发送未捕获异常通知失败");
|
|
1764
1773
|
});
|
|
1765
1774
|
});
|
|
1766
1775
|
process.on("unhandledRejection", async (err) => {
|
|
1767
1776
|
const msg = stringifyError(err);
|
|
1768
|
-
napcat.logger.error(
|
|
1777
|
+
napcat.logger.error(`unhandledRejection, 出错了: ${msg}`);
|
|
1769
1778
|
if (Date.now() - lastNoticeTime < 1e3) return;
|
|
1770
1779
|
lastNoticeTime = Date.now();
|
|
1771
1780
|
const date = (/* @__PURE__ */ new Date()).toLocaleString();
|
|
1772
1781
|
await noticeMainOwner(napcat, `【${date}】\n\nmioki 发生未处理异常:\n\n${msg}`).catch(() => {
|
|
1773
|
-
napcat.logger.error("
|
|
1782
|
+
napcat.logger.error("发送未处理异常通知失败");
|
|
1774
1783
|
});
|
|
1775
1784
|
});
|
|
1776
1785
|
ensurePluginDir();
|
|
@@ -1779,7 +1788,7 @@ async function start(options = {}) {
|
|
|
1779
1788
|
absPath: node_path.default.resolve(plugin_dir, p)
|
|
1780
1789
|
})).filter((p) => {
|
|
1781
1790
|
if (!node_fs.default.existsSync(p.absPath)) {
|
|
1782
|
-
napcat.logger.warn(
|
|
1791
|
+
napcat.logger.warn(`插件 ${consola_utils.colors.red(p.dirName)} 不存在,已忽略`);
|
|
1783
1792
|
return false;
|
|
1784
1793
|
}
|
|
1785
1794
|
return true;
|
|
@@ -1789,7 +1798,7 @@ async function start(options = {}) {
|
|
|
1789
1798
|
try {
|
|
1790
1799
|
const plugin = await jiti$1.import(absPath, { default: true });
|
|
1791
1800
|
if (plugin.name !== dirName) {
|
|
1792
|
-
const tip =
|
|
1801
|
+
const tip = `插件目录名 [${consola_utils.colors.yellow(dirName)}] 和插件声明的 name [${consola_utils.colors.yellow(plugin.name)}] 不一致,可能导致重载异常,请修改一致后重启。`;
|
|
1793
1802
|
napcat.logger.warn(tip);
|
|
1794
1803
|
noticeMainOwner(napcat, tip);
|
|
1795
1804
|
}
|
|
@@ -1803,7 +1812,7 @@ async function start(options = {}) {
|
|
|
1803
1812
|
const start$1 = node_process.hrtime.bigint();
|
|
1804
1813
|
const sortedUserPlugins = (await Promise.all(promises)).filter(Boolean).toSorted((prev, next) => (prev.priority ?? 100) - (next.priority ?? 100));
|
|
1805
1814
|
if (failedImportPlugins.length) {
|
|
1806
|
-
const tip =
|
|
1815
|
+
const tip = `${consola_utils.colors.red(failedImportPlugins.length)} 个插件加载失败: \n\n${failedImportPlugins.map(([dirName, err]) => `${dirName}: ${err}`).join("\n\n")}`;
|
|
1807
1816
|
napcat.logger.warn(tip);
|
|
1808
1817
|
noticeMainOwner(napcat, tip);
|
|
1809
1818
|
}
|
|
@@ -1816,7 +1825,7 @@ async function start(options = {}) {
|
|
|
1816
1825
|
const sortedGroups = Array.from(pluginGroups.entries()).toSorted(([a], [b]) => a - b);
|
|
1817
1826
|
const failedEnablePlugins = [];
|
|
1818
1827
|
try {
|
|
1819
|
-
napcat.logger.info(
|
|
1828
|
+
napcat.logger.info(`加载内置插件: ${BUILTIN_PLUGINS.map((p) => consola_utils.colors.cyan(p.name)).join(", ")}`);
|
|
1820
1829
|
await Promise.all(BUILTIN_PLUGINS.map((p) => enablePlugin(napcat, p, "builtin")));
|
|
1821
1830
|
for (const [_, plugins$1] of sortedGroups) await Promise.all(plugins$1.map(async (p) => {
|
|
1822
1831
|
try {
|
|
@@ -1828,17 +1837,17 @@ async function start(options = {}) {
|
|
|
1828
1837
|
} catch (e) {
|
|
1829
1838
|
napcat.logger.error(e?.message);
|
|
1830
1839
|
await noticeMainOwner(napcat, e?.message).catch(() => {
|
|
1831
|
-
napcat.logger.error("
|
|
1840
|
+
napcat.logger.error("发送插件启用失败通知失败");
|
|
1832
1841
|
});
|
|
1833
1842
|
}
|
|
1834
1843
|
const end = node_process.hrtime.bigint();
|
|
1835
1844
|
const costTime = Math.round(Number(end - start$1)) / 1e6;
|
|
1836
1845
|
const failedCount = failedImportPlugins.length + failedEnablePlugins.length;
|
|
1837
|
-
const failedInfo = failedCount > 0 ? `${consola_utils.colors.
|
|
1838
|
-
napcat.logger.info(
|
|
1839
|
-
napcat.logger.info(consola_utils.colors.
|
|
1846
|
+
const failedInfo = failedCount > 0 ? `${consola_utils.colors.red(failedCount)} 个失败 (导入 ${consola_utils.colors.red(failedImportPlugins.length)},启用 ${consola_utils.colors.red(failedEnablePlugins.length)})` : "";
|
|
1847
|
+
napcat.logger.info(`成功加载了 ${consola_utils.colors.green(runtimePlugins.size)} 个插件,${failedInfo ? failedInfo : ""}总耗时 ${consola_utils.colors.green(costTime.toFixed(2))} 毫秒`);
|
|
1848
|
+
napcat.logger.info(consola_utils.colors.green(`mioki v${version} 启动完成,祝您使用愉快 🎉️`));
|
|
1840
1849
|
if (botConfig.online_push) await noticeMainOwner(napcat, `✅ mioki v${version} 已就绪`).catch((err) => {
|
|
1841
|
-
napcat.logger.error(
|
|
1850
|
+
napcat.logger.error(`发送就绪通知失败: ${stringifyError(err)}`);
|
|
1842
1851
|
});
|
|
1843
1852
|
});
|
|
1844
1853
|
await napcat.run();
|
|
@@ -1853,7 +1862,25 @@ exports.base64Decode = base64Decode;
|
|
|
1853
1862
|
exports.base64Encode = base64Encode;
|
|
1854
1863
|
exports.bindBot = bindBot;
|
|
1855
1864
|
exports.botConfig = botConfig;
|
|
1865
|
+
Object.defineProperty(exports, 'box', {
|
|
1866
|
+
enumerable: true,
|
|
1867
|
+
get: function () {
|
|
1868
|
+
return consola_utils.box;
|
|
1869
|
+
}
|
|
1870
|
+
});
|
|
1856
1871
|
exports.clamp = clamp;
|
|
1872
|
+
Object.defineProperty(exports, 'colorize', {
|
|
1873
|
+
enumerable: true,
|
|
1874
|
+
get: function () {
|
|
1875
|
+
return consola_utils.colorize;
|
|
1876
|
+
}
|
|
1877
|
+
});
|
|
1878
|
+
Object.defineProperty(exports, 'colors', {
|
|
1879
|
+
enumerable: true,
|
|
1880
|
+
get: function () {
|
|
1881
|
+
return consola_utils.colors;
|
|
1882
|
+
}
|
|
1883
|
+
});
|
|
1857
1884
|
exports.createCmd = createCmd;
|
|
1858
1885
|
exports.createDB = createDB;
|
|
1859
1886
|
exports.createForwardMsg = createForwardMsg;
|
|
@@ -1897,6 +1924,7 @@ exports.getBfaceUrl = getBfaceUrl;
|
|
|
1897
1924
|
exports.getGroupAvatarLink = getGroupAvatarLink;
|
|
1898
1925
|
exports.getImage = getImage;
|
|
1899
1926
|
exports.getImageUrl = getImageUrl;
|
|
1927
|
+
exports.getLogFilePath = getLogFilePath;
|
|
1900
1928
|
exports.getMentionedImage = getMentionedImage;
|
|
1901
1929
|
exports.getMentionedImageUrl = getMentionedImageUrl;
|
|
1902
1930
|
exports.getMentionedUserId = getMentionedUserId;
|
|
@@ -1926,6 +1954,7 @@ exports.jiti = jiti$1;
|
|
|
1926
1954
|
exports.localNum = localNum;
|
|
1927
1955
|
exports.localeDate = localeDate;
|
|
1928
1956
|
exports.localeTime = localeTime;
|
|
1957
|
+
exports.logger = logger;
|
|
1929
1958
|
exports.match = match;
|
|
1930
1959
|
exports.md5 = md5;
|
|
1931
1960
|
Object.defineProperty(exports, 'mri', {
|
|
@@ -1974,6 +2003,12 @@ Object.defineProperty(exports, 'string2argv', {
|
|
|
1974
2003
|
}
|
|
1975
2004
|
});
|
|
1976
2005
|
exports.stringifyError = stringifyError;
|
|
2006
|
+
Object.defineProperty(exports, 'stripAnsi', {
|
|
2007
|
+
enumerable: true,
|
|
2008
|
+
get: function () {
|
|
2009
|
+
return consola_utils.stripAnsi;
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
1977
2012
|
Object.defineProperty(exports, 'systemInfo', {
|
|
1978
2013
|
enumerable: true,
|
|
1979
2014
|
get: function () {
|