mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
fix: promise包装start()
This commit is contained in:
parent
9420037305
commit
8c53ddd23f
@ -59,29 +59,33 @@ const pushplus = (text, desp) => {
|
||||
/**
|
||||
* 主函数
|
||||
* @param {string} cookie
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function start() {
|
||||
let times = Base.counter();
|
||||
/* 注册事件 */
|
||||
eventBus.on('Turn_on_the_Monitor', () => {
|
||||
if (times.value() === GlobalVar.Lottery.length) {
|
||||
console.log('所有动态转发完毕');
|
||||
console.log('[运行结束]目前无抽奖信息,过一会儿再来看看吧');
|
||||
times.clear();
|
||||
Public.prototype.checkAllDynamic(GlobalVar.myUID, 1).then(Dynamic => {
|
||||
if (Dynamic.allModifyDynamicResArray[0].type === 1) {
|
||||
Base.getHiToKoTo().then(sentence => {
|
||||
BiliAPI.createDynamic(sentence);
|
||||
})
|
||||
}
|
||||
})
|
||||
return;
|
||||
}
|
||||
const lottery = GlobalVar.Lottery[times.next()];
|
||||
const nlottery = Number(lottery);
|
||||
(new Monitor(isNaN(nlottery) ? lottery : nlottery)).init();
|
||||
return new Promise(resolve => {
|
||||
let times = Base.counter();
|
||||
/* 注册事件 */
|
||||
eventBus.on('Turn_on_the_Monitor', () => {
|
||||
if (times.value() === GlobalVar.Lottery.length) {
|
||||
console.log('所有动态转发完毕');
|
||||
console.log('[运行结束]目前无抽奖信息,过一会儿再来看看吧');
|
||||
times.clear();
|
||||
Public.prototype.checkAllDynamic(GlobalVar.myUID, 1).then(Dynamic => {
|
||||
if (Dynamic.allModifyDynamicResArray[0].type === 1) {
|
||||
Base.getHiToKoTo().then(sentence => {
|
||||
BiliAPI.createDynamic(sentence);
|
||||
})
|
||||
}
|
||||
})
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
const lottery = GlobalVar.Lottery[times.next()];
|
||||
const nlottery = Number(lottery);
|
||||
(new Monitor(isNaN(nlottery) ? lottery : nlottery)).init();
|
||||
});
|
||||
eventBus.emit('Turn_on_the_Monitor');
|
||||
});
|
||||
eventBus.emit('Turn_on_the_Monitor');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user