From 5df207192d80b9068bcfe17f9ede66bc89d1644a Mon Sep 17 00:00:00 2001 From: yeyang <746659424@qq.com> Date: Tue, 26 Mar 2024 10:55:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E7=8A=B6?= =?UTF-8?q?=E6=80=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/State/index.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/model/State/index.js b/model/State/index.js index 134b042..2c712d0 100644 --- a/model/State/index.js +++ b/model/State/index.js @@ -36,21 +36,14 @@ export async function getData (e) { let [FastFetch, HardDisk, psTest] = await Promise.all(promiseTaskList) /** bot列表 */ - let BotList = [e.self_id] + let BotList = _getBotList(e) - 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 - } - } return { BotStatus: await getBotState(BotList), chartData: JSON.stringify(common.checkIfEmpty(Monitor.chartData, ['echarts_theme', 'cpu', 'ram']) ? undefined : Monitor.chartData), visualData, otherInfo: _getOtherInfo(), - psTest, + psTest: _.isEmpty(psTest) ? undefined : psTest, FastFetch, HardDisk, // 硬盘速率 @@ -69,5 +62,20 @@ function _getOtherInfo () { otherInfo.push(Monitor.getNetwork) // 插件数量 otherInfo.push(getPluginNum()) - return otherInfo + + return _.compact(otherInfo) +} + +function _getBotList (e) { + /** bot列表 */ + let BotList = [e.self_id] + + 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 + } + } + return BotList }