mioki 0.16.0 → 0.16.1
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/cli.cjs +1 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +1 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +14 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +14 -17
- package/dist/index.mjs.map +1 -1
- package/dist/{package-Cs8cEndC.cjs → package-Bryo1nSK.cjs} +2 -2
- package/dist/package-Bryo1nSK.cjs.map +1 -0
- package/dist/package-Bvcr71Zp.mjs +6 -0
- package/dist/package-Bvcr71Zp.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/package-Cs8cEndC.cjs.map +0 -1
- package/dist/package-UYRX612w.mjs +0 -6
- package/dist/package-UYRX612w.mjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -32,7 +32,6 @@ interface ExtendedNapCat extends NapCat {
|
|
|
32
32
|
bot_id: number;
|
|
33
33
|
app_name: string;
|
|
34
34
|
app_version: string;
|
|
35
|
-
name?: string;
|
|
36
35
|
}
|
|
37
36
|
declare const connectedBots: Map<number, ExtendedNapCat>;
|
|
38
37
|
declare function start(options?: StartOptions): Promise<void>;
|
|
@@ -551,7 +550,6 @@ declare const ArchMap: Record<string, string>;
|
|
|
551
550
|
interface BotStatus {
|
|
552
551
|
uin: number;
|
|
553
552
|
nickname: string;
|
|
554
|
-
name?: string;
|
|
555
553
|
friends: number;
|
|
556
554
|
groups: number;
|
|
557
555
|
send: number;
|
package/dist/index.d.mts
CHANGED
|
@@ -30,7 +30,6 @@ interface ExtendedNapCat extends NapCat {
|
|
|
30
30
|
bot_id: number;
|
|
31
31
|
app_name: string;
|
|
32
32
|
app_version: string;
|
|
33
|
-
name?: string;
|
|
34
33
|
}
|
|
35
34
|
declare const connectedBots: Map<number, ExtendedNapCat>;
|
|
36
35
|
declare function start(options?: StartOptions): Promise<void>;
|
|
@@ -549,7 +548,6 @@ declare const ArchMap: Record<string, string>;
|
|
|
549
548
|
interface BotStatus {
|
|
550
549
|
uin: number;
|
|
551
550
|
nickname: string;
|
|
552
|
-
name?: string;
|
|
553
551
|
friends: number;
|
|
554
552
|
groups: number;
|
|
555
553
|
send: number;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BiucMVzj.mjs";
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-Bvcr71Zp.mjs";
|
|
3
3
|
import fs, { default as fs$1 } from "node:fs";
|
|
4
4
|
import util from "node:util";
|
|
5
5
|
import path, { default as path$1 } from "node:path";
|
|
@@ -1526,7 +1526,6 @@ async function getMiokiStatus(bots) {
|
|
|
1526
1526
|
botStatuses.push({
|
|
1527
1527
|
uin: bot.bot_id,
|
|
1528
1528
|
nickname: bot.nickname,
|
|
1529
|
-
name: bot.name,
|
|
1530
1529
|
friends: friendList.length,
|
|
1531
1530
|
groups: groupList.length,
|
|
1532
1531
|
send: bot.stat.send.group + bot.stat.send.private,
|
|
@@ -1538,7 +1537,6 @@ async function getMiokiStatus(bots) {
|
|
|
1538
1537
|
botStatuses.push({
|
|
1539
1538
|
uin: bot.bot_id,
|
|
1540
1539
|
nickname: bot.nickname,
|
|
1541
|
-
name: bot.name,
|
|
1542
1540
|
friends: 0,
|
|
1543
1541
|
groups: 0,
|
|
1544
1542
|
send: 0,
|
|
@@ -1593,13 +1591,14 @@ async function formatMiokiStatus(status) {
|
|
|
1593
1591
|
const { bots, plugins, stats, system, disk, cpu, memory, versions } = status;
|
|
1594
1592
|
const diskValid = disk.total > 0 && disk.free >= 0;
|
|
1595
1593
|
const diskDesc = `${disk.percent}%-${filesize(disk.used, { round: 1 })}/${filesize(disk.total, { round: 1 })}`;
|
|
1594
|
+
const botLines = bots.map((bot) => {
|
|
1595
|
+
return `👤 ${bot.nickname} (${bot.uin})\n 📋 ${localNum(bot.friends)} 好友 / ${localNum(bot.groups)} 群 / 📮 收 ${localNum(bot.receive)} 发 ${localNum(bot.send)}`;
|
|
1596
|
+
}).join("\n");
|
|
1597
|
+
const statsLine = bots.length > 1 ? `\n📮 总计: 收 ${localNum(stats.receive)} 条,发 ${localNum(stats.send)} 条` : "";
|
|
1596
1598
|
return `
|
|
1597
1599
|
〓 🟢 mioki 状态 〓
|
|
1598
|
-
${
|
|
1599
|
-
|
|
1600
|
-
}).join("\n")}
|
|
1601
|
-
🧩 启用了 ${localNum(plugins.enabled)} 个插件,共 ${localNum(plugins.total)} 个
|
|
1602
|
-
📮 总计: 收 ${localNum(stats.receive)} 条,发 ${localNum(stats.send)} 条
|
|
1600
|
+
${botLines}
|
|
1601
|
+
🧩 启用了 ${localNum(plugins.enabled)} 个插件,共 ${localNum(plugins.total)} 个${statsLine}
|
|
1603
1602
|
🚀 ${filesize(memory.rss.used, { round: 1 })}/${memory.percent}%
|
|
1604
1603
|
⏳ 已运行 ${prettyMs(stats.uptime, {
|
|
1605
1604
|
hideYear: true,
|
|
@@ -1939,8 +1938,8 @@ const BUILTIN_PLUGINS = [core_default];
|
|
|
1939
1938
|
//#region src/start.ts
|
|
1940
1939
|
const connectedBots = /* @__PURE__ */ new Map();
|
|
1941
1940
|
async function connectBot(config, index) {
|
|
1942
|
-
const { protocol = "ws", port = 3001, host = "localhost", token = ""
|
|
1943
|
-
const botName =
|
|
1941
|
+
const { protocol = "ws", port = 3001, host = "localhost", token = "" } = config;
|
|
1942
|
+
const botName = `Bot${index + 1}`;
|
|
1944
1943
|
const wsUrl = colors$1.green(`${protocol}://${host}:${port}${token ? "?access_token=***" : ""}`);
|
|
1945
1944
|
logger.info(`>>> 正在连接 ${colors$1.cyan(botName)}: ${wsUrl}`);
|
|
1946
1945
|
const napcat = new NapCat({
|
|
@@ -1960,8 +1959,7 @@ async function connectBot(config, index) {
|
|
|
1960
1959
|
napcat.once("napcat.connected", ({ user_id, nickname, app_name, app_version }) => {
|
|
1961
1960
|
logger.info(`已连接到 ${colors$1.cyan(botName)}: ${colors$1.green(`${app_name}-v${app_version} ${nickname}(${user_id})`)}`);
|
|
1962
1961
|
if (connectedBots.has(user_id)) {
|
|
1963
|
-
|
|
1964
|
-
if (existingBot.name) logger.warn(`${colors$1.yellow(botName)} (${user_id}) 与 ${colors$1.yellow(existingBot.name)} (${user_id}) QQ 号重复,将跳过`);
|
|
1962
|
+
logger.warn(`${colors$1.yellow(botName)} (${user_id}) 与已存在的 bot (${user_id}) QQ 号重复,将跳过`);
|
|
1965
1963
|
napcat.close();
|
|
1966
1964
|
resolve(null);
|
|
1967
1965
|
return;
|
|
@@ -1970,7 +1968,6 @@ async function connectBot(config, index) {
|
|
|
1970
1968
|
extendedNapCat.bot_id = user_id;
|
|
1971
1969
|
extendedNapCat.app_name = app_name;
|
|
1972
1970
|
extendedNapCat.app_version = app_version;
|
|
1973
|
-
extendedNapCat.name = botName;
|
|
1974
1971
|
resolve(extendedNapCat);
|
|
1975
1972
|
});
|
|
1976
1973
|
napcat.run().catch((err) => {
|
|
@@ -2077,10 +2074,10 @@ async function start(options = {}) {
|
|
|
2077
2074
|
}
|
|
2078
2075
|
const seenEndpoints = /* @__PURE__ */ new Set();
|
|
2079
2076
|
const duplicateConfigs = [];
|
|
2080
|
-
for (
|
|
2081
|
-
const { protocol = "ws", host = "localhost", port = 3001 } =
|
|
2077
|
+
for (let i = 0; i < napcatConfigs.length; i++) {
|
|
2078
|
+
const { protocol = "ws", host = "localhost", port = 3001 } = napcatConfigs[i];
|
|
2082
2079
|
const endpoint = `${protocol}://${host}:${port}`;
|
|
2083
|
-
if (seenEndpoints.has(endpoint)) duplicateConfigs.push(
|
|
2080
|
+
if (seenEndpoints.has(endpoint)) duplicateConfigs.push(`Bot${i + 1} (${endpoint})`);
|
|
2084
2081
|
else seenEndpoints.add(endpoint);
|
|
2085
2082
|
}
|
|
2086
2083
|
if (duplicateConfigs.length > 0) {
|
|
@@ -2098,7 +2095,7 @@ async function start(options = {}) {
|
|
|
2098
2095
|
}
|
|
2099
2096
|
for (const bot of bots) connectedBots.set(bot.bot_id, bot);
|
|
2100
2097
|
if (bots.length < napcatConfigs.length) logger.warn(`${colors$1.yellow(napcatConfigs.length - bots.length)} 个 NapCat 实例连接失败`);
|
|
2101
|
-
const botNames = bots.map((b) => `${b.
|
|
2098
|
+
const botNames = bots.map((b) => `${b.bot_id}`).join(", ");
|
|
2102
2099
|
logger.info(colors$1.green(`成功连接 ${bots.length} 个实例: ${botNames}`));
|
|
2103
2100
|
logger.info(colors$1.dim("=".repeat(40)));
|
|
2104
2101
|
const mainBot = bots[0];
|