mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-12 21:03:13 +08:00
perf: 储存转发成功的dyid
This commit is contained in:
parent
0c9876a92a
commit
ba261dbf3c
@ -56,24 +56,20 @@ class Monitor extends Public {
|
||||
let index = 0;
|
||||
if (len === 0) {
|
||||
eventBus.emit('Turn_on_the_Monitor');
|
||||
return false;
|
||||
} else {
|
||||
let dyids = [];
|
||||
allLottery.forEach(lottery => {
|
||||
let dyid = lottery.dyid;
|
||||
if (typeof dyid === 'string') dyids.push(dyid);
|
||||
})
|
||||
MyStorage.updateDyid((Array.from(new Set([...dyids, ...this.AllMyLotteryInfo.split(',')]))).toString())
|
||||
for (const Lottery of allLottery) {
|
||||
const a = await this.go(Lottery);
|
||||
if (a === 0) return;
|
||||
if (await this.go(Lottery) === 0) break;
|
||||
dyids.push(Lottery.dyid);
|
||||
if (index++ === len - 1) {
|
||||
console.log('开始转发下一组动态');
|
||||
eventBus.emit('Turn_on_the_Monitor');
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MyStorage.updateDyid((Array.from(new Set([...dyids, ...this.AllMyLotteryInfo.split(',')]))).toString())
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* 抽奖配置
|
||||
@ -175,8 +171,7 @@ class Monitor extends Public {
|
||||
1 : 0;
|
||||
/* 是否评论 */
|
||||
if (isSendChat) onelotteryinfo.rid = rid;
|
||||
if (typeof onelotteryinfo.uid === 'undefined' && typeof onelotteryinfo.dyid === 'undefined') continue;
|
||||
alllotteryinfo.push(onelotteryinfo);
|
||||
if (onelotteryinfo.dyid) alllotteryinfo.push(onelotteryinfo);
|
||||
}
|
||||
}
|
||||
return alllotteryinfo;
|
||||
@ -188,30 +183,28 @@ class Monitor extends Public {
|
||||
*/
|
||||
async go(option) {
|
||||
const { uid, dyid, type, rid, relay_chat, ctrl } = option;
|
||||
if (typeof dyid === 'string') {
|
||||
if (typeof rid === 'string' && type !== 0) {
|
||||
if (await BiliAPI.sendChat(rid, Base.getRandomStr(config.chat), type) === 0) return 0;
|
||||
}
|
||||
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 (await BiliAPI.autoRelay(GlobalVar.myUID, dyid, relay_chat, ctrl) === 0) return 0;
|
||||
if (await BiliAPI.autolike(dyid) === 0) return 0;
|
||||
await Base.delay(Number(config.wait) + Math.floor(Math.random() * 60000 - 30000));
|
||||
if (typeof rid === 'string' && type !== 0) {
|
||||
if (await BiliAPI.sendChat(rid, Base.getRandomStr(config.chat), type) === 0) return 0;
|
||||
}
|
||||
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 (await BiliAPI.autoRelay(GlobalVar.myUID, dyid, relay_chat, ctrl) === 0) return 0;
|
||||
if (await BiliAPI.autolike(dyid) === 0) return 0;
|
||||
await Base.delay(Number(config.wait) + Math.floor(Math.random() * 60000 - 30000));
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user