diff --git a/lib/BiliAPI.js b/lib/BiliAPI.js index 85d5579..d50a01c 100644 --- a/lib/BiliAPI.js +++ b/lib/BiliAPI.js @@ -281,6 +281,7 @@ const BiliAPI = { mid: uid, photo: false }, + retry: false, hasCookies: true, success: responseText => { const res = strToJson(responseText); diff --git a/lib/Monitor.js b/lib/Monitor.js index 3f4b1ee..7d010d0 100644 --- a/lib/Monitor.js +++ b/lib/Monitor.js @@ -41,21 +41,23 @@ class Monitor extends Public { async startLottery() { const allLottery = await this.filterLotteryInfo(); let status = 0; - if (allLottery.length) { - let dyids = []; - for (const Lottery of allLottery) { - status = await this.go(Lottery); - if (!status) break - dyids.push(Lottery.dyid); + if (allLottery instanceof Array) { + if (allLottery.length) { + let dyids = []; + for (const Lottery of allLottery) { + status = await this.go(Lottery); + if (!status) break + dyids.push(Lottery.dyid); + } + if (dyids.length) MyStorage.updateDyid(dyids.toString()) + Base.tooltip.log('开始转发下一组动态'); + } else { + status = 1; + Base.tooltip.log('无未转发抽奖'); } - if (dyids.length) MyStorage.updateDyid(dyids.toString()) - Base.tooltip.log('开始转发下一组动态'); - } else { - status = 1; - Base.tooltip.log('无未转发抽奖'); - } - status ? - eventBus.emit('Turn_on_the_Monitor') : eventBus.emit('Turn_off_the_Monitor'); + } else { status = 0 } + + status ? eventBus.emit('Turn_on_the_Monitor') : eventBus.emit('Turn_off_the_Monitor'); } /** * 抽奖配置 @@ -68,7 +70,7 @@ class Monitor extends Public { * @property {string} rid 评论类型 */ /** - * @returns {Promise} + * @returns {Promise} */ async filterLotteryInfo() { const self = this, @@ -112,15 +114,16 @@ class Monitor extends Public { if (hasOfficialLottery && model[0] === '1') { const oneLNotice = await BiliAPI.getLotteryNotice(dyid); ts = oneLNotice.ts; + if (!ts) { alllotteryinfo = null; break } isLottery = ts > now_ts_10 && ts < now_ts_10 + maxday; isSendChat = chatmodel[0] === '1'; - } else if (!hasOfficialLottery && model[1] === '1') { - if (!haslottery) continue; + } else if (!hasOfficialLottery && model[1] === '1' && haslottery && hasGuanZhuan) { ts = Base.getLotteryNotice(description).ts; if (!official_verify) { const followerNum = await BiliAPI.getUserInfo(uid); + if (!followerNum) { alllotteryinfo = null; break } if (followerNum < Number(minfollower)) continue; - isLottery = hasGuanZhuan && !befilter && (ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday)); + isLottery = !befilter && (ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday)); } else { isLottery = ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday); }