diff --git a/apps/state.js b/apps/state.js index faf20c8..e59db8b 100644 --- a/apps/state.js +++ b/apps/state.js @@ -79,77 +79,21 @@ export class NewState extends plugin { // Node板块 State.getNodeInfo() ])) - const defaultAvatar = `../../../../../plugins/${Plugin_Name}/resources/state/img/default_avatar.jpg` - // 机器人名称 - const BotName = Version.name - // 系统运行时间 - const systime = common.formatTime(os.uptime(), 'dd天hh小时mm分', false) - // 日历 - const calendar = moment().format('YYYY-MM-DD HH:mm:ss') - // nodejs版本 - let BotStatus = "" /** bot列表 */ let BotList = [e.self_id] - /** TRSS */ - if (e.msg.includes("pro") && Array.isArray(Bot?.uin)) { - BotList = Bot.uin - } - /** ws-plugin、Lain-plugin多bot */ - else if (e.msg.includes("pro") && !Array.isArray(Bot?.uin) && Bot?.adapter && Bot?.adapter.includes(e.self_id)) { - BotList = Bot.adapter + + if (e.msg.includes('pro')) { + if (Array.isArray(Bot?.uin)) { + BotList = Bot.uin + } else if (Bot?.adapter && Bot.adapter.includes(e.self_id)) { + BotList = Bot.adapter + } } - for (const i of BotList) { - const bot = Bot[i] - if (!bot?.uin) continue - // 头像 - const avatar = bot.avatar || (Number(bot.uin) ? `https://q1.qlogo.cn/g?b=qq&s=0&nk=${bot.uin}` : defaultAvatar) - // 昵称 - const nickname = bot.nickname || "未知" - // 在线状态 - const onlineStatus = status[bot.status] || "在线" - // 登录平台版本 - const platform = bot.apk ? `${bot.apk.display} v${bot.apk.version}` : bot.version.version || "未知" - // 发 - const sent = await redis.get(`Yz:count:send:msg:bot:${bot.uin}:total`) || await redis.get('Yz:count:sendMsg:total') || 0 - // 收 - const recv = await redis.get(`Yz:count:receive:msg:bot:${bot.uin}:total`) || bot.stat?.recv_msg_cnt || "未知" - // 图片 - const screenshot = await redis.get(`Yz:count:send:image:bot:${bot.uin}:total`) || await redis.get('Yz:count:screenshot:total') || 0 - // 好友数 - const friendQuantity = Array.from(bot.fl?.keys()).length - // 群数 - const groupQuantity = Array.from(bot.gl?.keys()).length - // 群员数 - let groupMemberQuantity = 0 - for (const i of bot.gml?.values() || []) - groupMemberQuantity += Array.from(i.keys()).length - // 运行时间 - const runTime = common.formatTime(Date.now() / 1000 - bot.stat?.start_time, 'dd天hh小时mm分', false) - // Bot版本 - const botVersion = bot.version ? `${bot.version.name}(${bot.version.id})${bot.apk ? ` ${bot.version.version}` : ""}` : `ICQQ(QQ) v${require('icqq/package.json').version}` - BotStatus += `
${onlineStatus}(${platform}) | ${botVersion}
-收${recv} | 发${sent} | 图片${screenshot} | 好友${friendQuantity} | 群${groupQuantity} | 群员${groupMemberQuantity}
-${BotName} 已运行 ${runTime} | 系统运行 ${systime}
-${calendar} | Node.js ${process.version} | ${process.platform} ${process.arch}
-${onlineStatus}(${platform}) | ${botVersion}
+收${recv} | 发${sent || 0} | 图片${screenshot || 0} | 好友${friendQuantity} | 群${groupQuantity} | 群员${groupMemberQuantity}
+${BotName} 已运行 ${runTime} | 系统运行 ${systime}
+${calendar} | Node.js ${process.version} | ${process.platform} ${process.arch}
+