Skip to content

Commit

Permalink
feat: 弃用update_loop_wait(#180)
Browse files Browse the repository at this point in the history
Fixed #180
  • Loading branch information
shanmiteko committed Sep 11, 2022
1 parent 35fe448 commit 7ab38f2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion lib/data/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ const config = {
lottery_loop_wait: 0,
check_loop_wait: 0,
clear_loop_wait: 0,
update_loop_wait: 0,

/**
* - 转发间隔时间
Expand Down
3 changes: 1 addition & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -24,4 +23,4 @@ async function checkCookie(num) {
}


module.exports = { start, isMe, clear, update, checkCookie }
module.exports = { start, isMe, clear, checkCookie }
16 changes: 9 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('抽奖', '开始运行');
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion my_config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ module.exports = Object.freeze({
lottery_loop_wait: 0,
check_loop_wait: 0,
clear_loop_wait: 0,
update_loop_wait: 0,

/**
* - 转发间隔时间
Expand Down

0 comments on commit 7ab38f2

Please sign in to comment.