From 65e636de7ccb6a8316403af10a9a907e9af67f0f Mon Sep 17 00:00:00 2001 From: shanmite <1971513084@qq.com> Date: Sun, 31 Jan 2021 12:33:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=B3=E6=B3=A8=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=97=B6=E5=8F=AA=E8=BD=AC=E5=8F=91=E5=B7=B2=E5=85=B3=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Monitor.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/Monitor.js b/lib/Monitor.js index c86b54a..a049bce 100644 --- a/lib/Monitor.js +++ b/lib/Monitor.js @@ -20,6 +20,7 @@ class Monitor extends Public { this.tagid = 0; /* tagid初始化为默认分组 */ this.attentionList = ''; /* 转为字符串的所有关注的up主uid */ this.AllMyLotteryInfo = ''; /* 转发过的动态信息 */ + this.isAttentionErr = false; } /** * 初始化 @@ -126,6 +127,7 @@ class Monitor extends Public { if (isLottery) { /* 判断是否关注过 */ const isFollowed = (new RegExp(uid)).test(self.attentionList); + if (this.isAttentionErr && !isFollowed) continue; /* 判断是否转发过 */ const isRelay = (new RegExp(dyid)).test(self.AllMyLotteryInfo); /* 获取黑名单并去重合并 */ @@ -180,16 +182,25 @@ class Monitor extends Public { async go(option) { const { uid, dyid, type, rid, relay_chat, ctrl } = option; if (typeof dyid === 'string') { + if (!this.isAttentionErr) { + uid.forEach(async (one_uid) => { + if (typeof one_uid === 'number') { + if (await BiliAPI.autoAttention(uid) === 0) { + this.isAttentionErr = true; + return + } + await Base.delay(5000); + if (await BiliAPI.movePartition(uid, this.tagid) === 0) { + this.isAttentionErr = true; + return + } + } + }) + } + if (this.isAttentionErr && uid.length !== 0) return 0; if (typeof rid === 'string' && type !== 0) { if (await BiliAPI.sendChat(rid, Base.getRandomStr(config.chat), type) === 0) return 0; } - uid.forEach(async (one_uid) => { - if (typeof one_uid === 'number') { - if (await BiliAPI.autoAttention(uid) === 0) return 0; - await Base.delay(5000); - if (await BiliAPI.movePartition(uid, this.tagid) === 0) return 0; - } - }) if (await BiliAPI.autoRelay(GlobalVar.myUID, dyid, relay_chat, ctrl) === 0) return 0; if (await MyStorage.updateDyid((Array.from(new Set([dyid, ...this.AllMyLotteryInfo.split(',')]))).toString()) === -1) return 0; if (await BiliAPI.autolike(dyid) === 0) return 0;