feat: 弃用update_loop_wait(#180)

Fixed #180
This commit is contained in:
shanmite 2022-09-11 17:53:31 +08:00
parent 35fe4481fa
commit 7ab38f258c
4 changed files with 10 additions and 11 deletions

View File

@ -170,7 +170,6 @@ const config = {
lottery_loop_wait: 0,
check_loop_wait: 0,
clear_loop_wait: 0,
update_loop_wait: 0,
/**
* - 转发间隔时间

View File

@ -1,7 +1,6 @@
const { isMe } = require('./check');
const { clear } = require('./clear');
const { start } = require('./lottery');
const { update } = require('./update');
const global_var = require('./data/global_var')
const bili = require('./net/bili')
const { log } = require('./utils')
@ -24,4 +23,4 @@ async function checkCookie(num) {
}
module.exports = { start, isMe, clear, update, checkCookie }
module.exports = { start, isMe, clear, checkCookie }

16
main.js
View File

@ -49,14 +49,14 @@ async function main() {
await global_var.init(COOKIE, NUMBER);
/**引入基础功能 */
const { start, isMe, clear, update, checkCookie } = require("./lib/index");
const { start, isMe, clear, checkCookie } = require("./lib/index");
log.info('main', '当前为第' + NUMBER + '个账号');
if (await checkCookie(NUMBER)) {
const mode = process.env.lottery_mode;
const help_msg = "用法: lottery [OPTIONS]\n\nOPTIONS:\n\tstart 启动抽奖\n\tcheck 中奖检查\n\tclear 清理动态和关注\n\tupdate 检查更新\n\thelp 帮助信息";
const { lottery_loop_wait, check_loop_wait, clear_loop_wait, update_loop_wait } = require("./lib/data/config");
const { lottery_loop_wait, check_loop_wait, clear_loop_wait } = require("./lib/data/config");
switch (mode) {
case 'start':
log.info('抽奖', '开始运行');
@ -75,11 +75,6 @@ async function main() {
await clear();
}
break;
case 'update':
log.info('检查更新', '开始')
loop_wait = update_loop_wait;
await update()
break;
case 'help':
return help_msg
case undefined:
@ -150,6 +145,13 @@ function initConfig() {
/**OPTIONS */
process.env.lottery_mode = process.argv[2]
if (process.env.lottery_mode === "update") {
log.info('检查更新', '开始')
await require("./lib/update").update()
log.info('检查更新', '请手动解压替换可执行文件')
return
}
const err_msg = await main();
if (err_msg) {
log.error('错误', err_msg);

View File

@ -183,7 +183,6 @@ module.exports = Object.freeze({
lottery_loop_wait: 0,
check_loop_wait: 0,
clear_loop_wait: 0,
update_loop_wait: 0,
/**
* - 转发间隔时间