mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
parent
39d69e0448
commit
b1f478cb8e
@ -317,6 +317,11 @@ const config = {
|
||||
"~你预约的直播已开始"
|
||||
],
|
||||
|
||||
/**
|
||||
* 是否发送运行状态通知
|
||||
*/
|
||||
notice_running_state: false,
|
||||
|
||||
/**
|
||||
* - 获取私信页数
|
||||
*/
|
||||
|
||||
@ -5,6 +5,7 @@ const { Searcher } = require('./core/searcher');
|
||||
const { Monitor } = require('./core/monitor');
|
||||
const config = require('./data/config');
|
||||
const { randomDynamic } = require('./helper/randomDynamic');
|
||||
const { sendNotify } = require('./helper/notify');
|
||||
const { log } = utils;
|
||||
|
||||
async function createRandomDynamic(num) {
|
||||
@ -23,12 +24,15 @@ async function createRandomDynamic(num) {
|
||||
|
||||
/**
|
||||
* 抽奖主函数
|
||||
* @param {string} cookie
|
||||
* @param {string} num
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function start() {
|
||||
function start(num) {
|
||||
return new Promise(resolve => {
|
||||
let times = utils.counter();
|
||||
if (config.notice_running_state) {
|
||||
sendNotify(`动态抽奖-帐号${num}开始抽奖`, "运行正常")
|
||||
}
|
||||
/* 注册事件 */
|
||||
event_bus.on('Turn_on_the_Monitor', async () => {
|
||||
const lotterys = global_var.get("Lottery");
|
||||
@ -48,6 +52,9 @@ function start() {
|
||||
await (new Monitor(lottery)).init();
|
||||
});
|
||||
event_bus.on('Turn_off_the_Monitor', async (msg) => {
|
||||
if (config.notice_running_state) {
|
||||
sendNotify(`动态抽奖-帐号${num}结束抽奖`, msg)
|
||||
}
|
||||
await createRandomDynamic(config.create_dy_num);
|
||||
log.info('结束抽奖', '原因: ' + msg);
|
||||
event_bus.flush();
|
||||
|
||||
2
main.js
2
main.js
@ -61,7 +61,7 @@ async function main() {
|
||||
case 'start':
|
||||
log.info('抽奖', '开始运行');
|
||||
loop_wait = lottery_loop_wait;
|
||||
await start();
|
||||
await start(NUMBER);
|
||||
break;
|
||||
case 'check':
|
||||
log.info('中奖检测', '检查是否中奖');
|
||||
|
||||
@ -336,6 +336,11 @@ module.exports = Object.freeze({
|
||||
"~你预约的直播已开始"
|
||||
],
|
||||
|
||||
/**
|
||||
* 是否发送运行状态通知
|
||||
*/
|
||||
notice_running_state: false,
|
||||
|
||||
/**
|
||||
* - 获取私信页数
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user