mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
parent
8bf5070459
commit
847e6806c6
@ -66,7 +66,7 @@ class Monitor extends Searcher {
|
|||||||
case 2004:
|
case 2004:
|
||||||
log.warn('账号异常', `UID(${global_var.get('myUID')})异常号只会对部分UP出现关注异常`)
|
log.warn('账号异常', `UID(${global_var.get('myUID')})异常号只会对部分UP出现关注异常`)
|
||||||
if (!config.is_exception) {
|
if (!config.is_exception) {
|
||||||
await sendNotify('[动态抽奖]账号异常通知', `UID: ${global_var.get('myUID')}\n\n异常号只会对部分UP出现关注异常\n\n可在设置中令is_exception为true关闭此推送`)
|
await sendNotify('[动态抽奖]账号异常通知', `UID: ${global_var.get('myUID')}\n异常号只会对部分UP出现关注异常\n可在设置中令is_exception为true关闭此推送\n${log._cache.filter(it => /Error|\[抽奖信息\]/.test(it)).join('\n')}`)
|
||||||
}
|
}
|
||||||
config.is_exception = true;
|
config.is_exception = true;
|
||||||
event_bus.emit('Turn_on_the_Monitor')
|
event_bus.emit('Turn_on_the_Monitor')
|
||||||
@ -74,7 +74,7 @@ class Monitor extends Searcher {
|
|||||||
case 2005:
|
case 2005:
|
||||||
log.warn('关注已达上限', `UID(${global_var.get('myUID')})关注已达上限,已临时进入只转已关注模式`)
|
log.warn('关注已达上限', `UID(${global_var.get('myUID')})关注已达上限,已临时进入只转已关注模式`)
|
||||||
if (!config.is_outof_maxfollow) {
|
if (!config.is_outof_maxfollow) {
|
||||||
await sendNotify('[动态抽奖]关注已达上限', `UID: ${global_var.get('myUID')}\n\n关注已达上限,已临时进入只转已关注模式\n\n可在设置中令is_outof_maxfollow为true关闭此推送`)
|
await sendNotify('[动态抽奖]关注已达上限', `UID: ${global_var.get('myUID')}\n关注已达上限,已临时进入只转已关注模式\n可在设置中令is_outof_maxfollow为true关闭此推送\n${log._cache.filter(it => /Error|\[抽奖信息\]/.test(it)).join('\n')}`)
|
||||||
}
|
}
|
||||||
config.is_outof_maxfollow = true;
|
config.is_outof_maxfollow = true;
|
||||||
config.only_followed = true;
|
config.only_followed = true;
|
||||||
|
|||||||
@ -34,9 +34,6 @@ async function createRandomDynamic(num) {
|
|||||||
function start(num) {
|
function start(num) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let times = utils.counter();
|
let times = utils.counter();
|
||||||
if (config.notice_running_state) {
|
|
||||||
sendNotify(`动态抽奖-帐号${num}开始抽奖`, "运行正常")
|
|
||||||
}
|
|
||||||
/* 注册事件 */
|
/* 注册事件 */
|
||||||
event_bus.on('Turn_on_the_Monitor', async () => {
|
event_bus.on('Turn_on_the_Monitor', async () => {
|
||||||
const lotterys = global_var.get("Lottery");
|
const lotterys = global_var.get("Lottery");
|
||||||
@ -56,11 +53,12 @@ function start(num) {
|
|||||||
await (new Monitor(lottery)).init();
|
await (new Monitor(lottery)).init();
|
||||||
});
|
});
|
||||||
event_bus.on('Turn_off_the_Monitor', async (msg) => {
|
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);
|
log.info('结束抽奖', '原因: ' + msg);
|
||||||
|
if (config.notice_running_state) {
|
||||||
|
sendNotify(`动态抽奖-帐号${num}结束抽奖`, `${log._cache.filter(it => /抽奖\]|Error|\[抽奖信息\]/.test(it)).join('\n')}`);
|
||||||
|
}
|
||||||
|
log._cache.length = 0;
|
||||||
|
await createRandomDynamic(config.create_dy_num);
|
||||||
event_bus.flush();
|
event_bus.flush();
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
|
|||||||
48
lib/utils.js
48
lib/utils.js
@ -189,8 +189,8 @@ const utils = {
|
|||||||
chalk.hex('#64B3FF'), chalk.grey, chalk.hex('#FFA500'),
|
chalk.hex('#64B3FF'), chalk.grey, chalk.hex('#FFA500'),
|
||||||
chalk.hex('#0070BB'), chalk.hex('#48BB31'), chalk.hex('#BBBB23'), chalk.hex('#FF0006')
|
chalk.hex('#0070BB'), chalk.hex('#48BB31'), chalk.hex('#BBBB23'), chalk.hex('#FF0006')
|
||||||
],
|
],
|
||||||
_iso_time: () => new Date(Date.now() + 288e5).toISOString().slice(0, -1) + '+08'
|
_iso_time: () => new Date(Date.now() + 288e5).toISOString().slice(0, -1) + '+08',
|
||||||
,
|
_cache: [],
|
||||||
/**
|
/**
|
||||||
* 初始化默认level为3
|
* 初始化默认level为3
|
||||||
*/
|
*/
|
||||||
@ -229,20 +229,50 @@ const utils = {
|
|||||||
debug(context, msg) {
|
debug(context, msg) {
|
||||||
if (this._level > 3) {
|
if (this._level > 3) {
|
||||||
if (msg instanceof Object) msg = JSON.stringify(msg, null, 4);
|
if (msg instanceof Object) msg = JSON.stringify(msg, null, 4);
|
||||||
this.proPrint([this._colors[0](`[${this._iso_time()}]`), this._colors[1]("[Debug]"), this._colors[2](`[帐号${process.env["NUMBER"]} ${context}]`), this._colors[3](`[\n${msg}\n]`)])
|
let color_text_pair = [
|
||||||
|
[this._colors[0], `[${this._iso_time()}]`],
|
||||||
|
[this._colors[1], "[Debug]"],
|
||||||
|
[this._colors[2], `[帐号${process.env["NUMBER"]} ${context}]`],
|
||||||
|
[this._colors[3], `[\n${msg}\n]`],
|
||||||
|
];
|
||||||
|
this.proPrint(color_text_pair.map(([color, text]) => color(text)))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
info(context, msg) {
|
info(context, msg) {
|
||||||
if (this._level > 2)
|
if (this._level > 2) {
|
||||||
this.proPrint([this._colors[0](`[${this._iso_time()}]`), this._colors[1]("[Info]"), this._colors[2](`[帐号${process.env["NUMBER"]} ${context}]`), this._colors[4](`[${msg}]`)])
|
let color_text_pair = [
|
||||||
|
[this._colors[0], `[${this._iso_time()}]`],
|
||||||
|
[this._colors[1], "[Info]"],
|
||||||
|
[this._colors[2], `[帐号${process.env["NUMBER"]} ${context}]`],
|
||||||
|
[this._colors[4], `[${msg}]`],
|
||||||
|
];
|
||||||
|
this._cache.push(color_text_pair.map(it => it[1]).join(' '));
|
||||||
|
this.proPrint(color_text_pair.map(([color, text]) => color(text)))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
warn(context, msg) {
|
warn(context, msg) {
|
||||||
if (this._level > 1)
|
if (this._level > 1) {
|
||||||
this.proPrint([this._colors[0](`[${this._iso_time()}]`), this._colors[1]("[Warn]"), this._colors[2](`[帐号${process.env["NUMBER"]} ${context}]`), this._colors[5](`[\n${msg}\n]`)])
|
let color_text_pair = [
|
||||||
|
[this._colors[0], `[${this._iso_time()}]`],
|
||||||
|
[this._colors[1], "[Warn]"],
|
||||||
|
[this._colors[2], `[帐号${process.env["NUMBER"]} ${context}]`],
|
||||||
|
[this._colors[5], `[\n${msg}\n]`],
|
||||||
|
];
|
||||||
|
this._cache.push(color_text_pair.map(it => it[1]).join(' '));
|
||||||
|
this.proPrint(color_text_pair.map(([color, text]) => color(text)))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error(context, msg) {
|
error(context, msg) {
|
||||||
if (this._level > 0)
|
if (this._level > 0) {
|
||||||
this.proPrint([this._colors[0](`[${this._iso_time()}]`), this._colors[1]("[Error]"), this._colors[2](`[帐号${process.env["NUMBER"]} ${context}]`), this._colors[6](`[\n${msg}\n]`)])
|
let color_text_pair = [
|
||||||
|
[this._colors[0], `[${this._iso_time()}]`],
|
||||||
|
[this._colors[1], "[Error]"],
|
||||||
|
[this._colors[2], `[帐号${process.env["NUMBER"]} ${context}]`],
|
||||||
|
[this._colors[6], `[\n${msg}\n]`],
|
||||||
|
];
|
||||||
|
this._cache.push(color_text_pair.map(it => it[1]).join(' '));
|
||||||
|
this.proPrint(color_text_pair.map(([color, text]) => color(text)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user