mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
parent
449c8d9272
commit
1a6291471a
@ -63,6 +63,15 @@ class Monitor extends Searcher {
|
||||
config.is_exception = true;
|
||||
event_bus.emit('Turn_on_the_Monitor')
|
||||
break
|
||||
case 23:
|
||||
log.warn('关注已达上限', `UID(${global_var.get('myUID')})关注已达上限,已临时进入只转已关注模式`)
|
||||
if (!config.is_outof_maxfollow) {
|
||||
await sendNotify('[动态抽奖]关注已达上限', `UID: ${global_var.get('myUID')}\n\n关注已达上限,已临时进入只转已关注模式\n\n可在设置中令is_outof_maxfollow为true关闭此推送`)
|
||||
}
|
||||
config.is_outof_maxfollow = true;
|
||||
config.only_followed = true;
|
||||
event_bus.emit('Turn_on_the_Monitor')
|
||||
break
|
||||
case 31:
|
||||
event_bus.emit('Turn_off_the_Monitor', '转发失败')
|
||||
break
|
||||
@ -89,12 +98,23 @@ class Monitor extends Searcher {
|
||||
log.info('筛选动态', `筛选完毕(${len})`);
|
||||
|
||||
if (len) {
|
||||
let is_exception = false;
|
||||
for (const [index, Lottery] of shuffle(allLottery).entries()) {
|
||||
let
|
||||
is_exception = 0,
|
||||
is_outof_maxfollow = 0;
|
||||
for (const [index, lottery] of shuffle(allLottery).entries()) {
|
||||
let status = 0;
|
||||
|
||||
if (Lottery.isOfficialLottery) {
|
||||
let { ts } = await bili.getLotteryNotice(Lottery.dyid);
|
||||
if (
|
||||
is_outof_maxfollow
|
||||
&& lottery.uid.length
|
||||
&& (new RegExp(lottery.uid.join('|'))).test(this.attentionList)
|
||||
) {
|
||||
log.info('过滤', `已关注(${lottery.uid.join(',')})`)
|
||||
continue
|
||||
}
|
||||
|
||||
if (lottery.isOfficialLottery) {
|
||||
let { ts } = await bili.getLotteryNotice(lottery.dyid);
|
||||
const ts_10 = Date.now() / 1000;
|
||||
if (ts < 0) {
|
||||
return 41
|
||||
@ -109,10 +129,10 @@ class Monitor extends Searcher {
|
||||
await delay(filter_wait)
|
||||
continue
|
||||
}
|
||||
} else if (Lottery.uid[0]) {
|
||||
} else if (lottery.uid[0]) {
|
||||
const { minfollower } = config
|
||||
if (minfollower > 0) {
|
||||
const followerNum = await bili.getUserInfo(Lottery.uid[0]);
|
||||
const followerNum = await bili.getUserInfo(lottery.uid[0]);
|
||||
if (followerNum < 0) {
|
||||
return 51
|
||||
}
|
||||
@ -135,14 +155,17 @@ class Monitor extends Searcher {
|
||||
randomDynamic(number)
|
||||
}
|
||||
|
||||
status = await this.go(Lottery)
|
||||
status = await this.go(lottery)
|
||||
switch (status) {
|
||||
case 0:
|
||||
case 9:
|
||||
case 19:
|
||||
break;
|
||||
case 22:
|
||||
is_exception = true
|
||||
is_exception = 22
|
||||
break;
|
||||
case 23:
|
||||
is_outof_maxfollow = 23
|
||||
break;
|
||||
default:
|
||||
return status
|
||||
@ -151,11 +174,9 @@ class Monitor extends Searcher {
|
||||
await delay(wait * (Math.random() + 0.5));
|
||||
}
|
||||
log.info('抽奖', '开始转发下一组动态');
|
||||
if (is_exception) {
|
||||
return 22
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
return is_exception
|
||||
|| is_outof_maxfollow
|
||||
|| 0
|
||||
} else {
|
||||
log.info('抽奖', '无未转发抽奖');
|
||||
return 0
|
||||
@ -403,6 +424,7 @@ class Monitor extends Searcher {
|
||||
* 19 - 关注黑名单
|
||||
* 21 - 关注错误
|
||||
* 22 - 关注异常
|
||||
* 23 - 关注已达上限
|
||||
* 31 - 转发失败
|
||||
*/
|
||||
async go(option) {
|
||||
@ -452,6 +474,7 @@ class Monitor extends Searcher {
|
||||
return false
|
||||
case -1:
|
||||
case 2:
|
||||
case 3:
|
||||
log.warn('抽奖信息', `uid: ${u},dyid: ${dyid}`)
|
||||
return true
|
||||
default:
|
||||
|
||||
@ -263,6 +263,11 @@ const config = {
|
||||
*/
|
||||
is_exception: false,
|
||||
|
||||
/**
|
||||
* 是否关注已达上限
|
||||
*/
|
||||
is_outof_maxfollow: false,
|
||||
|
||||
/**
|
||||
* - 中奖通知关键词(满足一个就推送)
|
||||
* - 符合js正则表达式的字符串
|
||||
|
||||
@ -620,9 +620,11 @@ const bili_client = {
|
||||
case 22002:
|
||||
return [false, -1, '您已被对方拉入黑名单']
|
||||
case 22003:
|
||||
return [false, -1, '黑名单用户无法关注', -1]
|
||||
return [false, -1, '黑名单用户无法关注']
|
||||
case 22015:
|
||||
return [false, 2, '账号异常', 2]
|
||||
return [false, 2, '账号异常']
|
||||
case 22009:
|
||||
return [false, 3, '关注已达上限']
|
||||
default:
|
||||
return [true, 1, `未知错误\n${responseText}`]
|
||||
}
|
||||
@ -638,6 +640,7 @@ const bili_client = {
|
||||
* 0 - 成功
|
||||
* 1 - 失败
|
||||
* 2 - 异常
|
||||
* 3 - 关注已达上限
|
||||
*/
|
||||
autoAttention(uid) {
|
||||
return this._autoAttention.run(uid)
|
||||
|
||||
@ -277,6 +277,11 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
is_exception: false,
|
||||
|
||||
/**
|
||||
* 是否关注已达上限
|
||||
*/
|
||||
is_outof_maxfollow: false,
|
||||
|
||||
/**
|
||||
* - 中奖通知关键词(满足一个就推送)
|
||||
* - 符合js正则表达式的字符串
|
||||
|
||||
Loading…
Reference in New Issue
Block a user