diff --git a/lib/data/config.js b/lib/data/config.js index c8b415e70..addc2b0a4 100644 --- a/lib/data/config.js +++ b/lib/data/config.js @@ -170,7 +170,6 @@ const config = { lottery_loop_wait: 0, check_loop_wait: 0, clear_loop_wait: 0, - update_loop_wait: 0, /** * - 转发间隔时间 diff --git a/lib/index.js b/lib/index.js index cb84a30f5..eeffa85c7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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 } \ No newline at end of file +module.exports = { start, isMe, clear, checkCookie } \ No newline at end of file diff --git a/main.js b/main.js index 69ebb7f6e..5afcff8e2 100644 --- a/main.js +++ b/main.js @@ -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); diff --git a/my_config.example.js b/my_config.example.js index 48dafdb0f..c13325692 100644 --- a/my_config.example.js +++ b/my_config.example.js @@ -183,7 +183,6 @@ module.exports = Object.freeze({ lottery_loop_wait: 0, check_loop_wait: 0, clear_loop_wait: 0, - update_loop_wait: 0, /** * - 转发间隔时间