From 1dd76fa4d63c2bf6f5c99d696b1267816918d6ab Mon Sep 17 00:00:00 2001 From: shanmite <1971513084@qq.com> Date: Mon, 25 Jan 2021 15:54:10 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=B0=86=E6=98=93=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E9=A2=91=E7=B9=81=E7=9A=84=E6=93=8D=E4=BD=9C=E6=8F=90=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + lib/Monitor.js | 22 +++++++++++----------- lib/config.js | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 752afea..e6c19c1 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,7 @@ lottery_*: - `wait` - 转发间隔时间 - 单位毫秒 + - 上下浮动30s - `minfollower` - up主粉丝数限制 - 仅限制没有官方认证的up diff --git a/lib/Monitor.js b/lib/Monitor.js index fdd2352..127b22c 100644 --- a/lib/Monitor.js +++ b/lib/Monitor.js @@ -140,24 +140,24 @@ class Monitor extends Public { /** * 关注转发评论 * @param {LotteryOptions} option + * @returns {Promise} sucess:1 err:0 */ async go(option) { const { uid, dyid, type, rid } = option; - let ret = ''; if (typeof dyid === 'string') { - ret += await BiliAPI.autoRelay(GlobalVar.myUID, dyid); - ret += await BiliAPI.autolike(dyid); - if (typeof uid === 'number') { - ret += await BiliAPI.autoAttention(uid); - await Base.delay(5000); - ret += await BiliAPI.movePartition(uid, this.tagid); - } if (typeof rid === 'string' && type !== 0) { - ret += await BiliAPI.sendChat(rid, Base.getRandomStr(config.chat), type); + if (await BiliAPI.sendChat(rid, Base.getRandomStr(config.chat), type) === 0) return 0; } - await Base.delay(Number(config.wait)); + if (typeof 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) === 0) return 0; + if (await BiliAPI.autolike(dyid) === 0) return 0; + await Base.delay(Number(config.wait) + Math.floor(Math.random() * 60000 - 30000)); } - return (ret === '' || ret.indexOf('0') === -1) ? 1 : 0; + return 1 } } diff --git a/lib/config.js b/lib/config.js index 91b7c28..72208a8 100644 --- a/lib/config.js +++ b/lib/config.js @@ -5,7 +5,7 @@ module.exports = { model: '11', chatmodel: '01', maxday: '-1', - wait: String(Math.floor(Math.random() * 1000) + 60000), + wait: '60000', minfollower: '1000', blacklist: '28008897,28272016,140389827,24598781,28008860,28008880,28008743,28008948,28009292,319696958,90138218,28272000,28272047,28271978,8831288,175979009,3177443,486780865,403048135,474325039,455274996,477519424,292671666,448873224,22498938,1770865,444796995,306112375,320193786,606637517,305276429,204487541,404761800,186914127,99439379,457697569,270886929,477519424,401575,201296348,206804212,333584926,34679178,699923691,392689522,178700744,272882445,350977368,487168411,22682842,444949061,523974463,192231907,503908324,383189098,252909207,336467750,264875137,90721742,452299642,677739290,441522918,8766623,698327474,5439672', blockword: ["脚本抽奖", "恭喜", "结果"],