From 0814154c7a99f43a7525b572c0ee2ecb6622221d Mon Sep 17 00:00:00 2001 From: shanmite Date: Tue, 3 Jan 2023 12:38:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=20=E5=85=B3=E6=B3=A8=E5=88=86=E5=8C=BA?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=8F=AF=E5=85=B3=E9=97=AD=20(#228)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed #228 --- lib/core/monitor.js | 23 +++++++++++++++-------- lib/data/config.js | 5 +++++ my_config.example.js | 5 +++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/lib/core/monitor.js b/lib/core/monitor.js index 011470d..a979331 100644 --- a/lib/core/monitor.js +++ b/lib/core/monitor.js @@ -37,7 +37,8 @@ class Monitor extends Searcher { event_bus.emit('Turn_off_the_Monitor', '已关闭所有转发行为') return } - if (!this.tagid) { + if (!this.tagid + && config.is_not_create_partition !== true) { this.tagid = await bili.checkMyPartition() /* 检查关注分区 */ if (!this.tagid) { event_bus.emit('Turn_off_the_Monitor', '分区获取失败') @@ -578,7 +579,7 @@ class Monitor extends Searcher { let status = 0 const { uid, dyid, chat_type, rid, relay_chat, ctrl, chat } = option, - { check_if_duplicated, is_repost_then_chat } = config; + { check_if_duplicated, is_repost_then_chat, is_not_create_partition } = config; /* 评论 */ if (rid && chat_type) { @@ -615,13 +616,19 @@ class Monitor extends Searcher { if (status) { log.warn("抽奖信息", `dyid: ${dyid}, uid: ${u}`) return true - } else if (await bili.movePartition(u, this.tagid)) { - log.warn("抽奖信息", `dyid: ${dyid}, uid: ${u} tagid: ${this.tagid}`) - /* 3000系错误 */ - status = 1001 - return true } else { - return false + if (is_not_create_partition !== true) { + if (await bili.movePartition(u, this.tagid)) { + log.warn("抽奖信息", `dyid: ${dyid}, uid: ${u} tagid: ${this.tagid}`) + /* 3000系错误 */ + status = 1001 + return true + } else { + return false + } + } else { + return false + } } }) if (status) return 2000 + status diff --git a/lib/data/config.js b/lib/data/config.js index 45ccc55..2955b6a 100644 --- a/lib/data/config.js +++ b/lib/data/config.js @@ -332,6 +332,11 @@ const config = { */ partition_id: 0, + /** + * - 是否不为抽奖UP单独设置关注分区 + */ + is_not_create_partition: false, + /** * 是否关注异常 */ diff --git a/my_config.example.js b/my_config.example.js index bb2e34d..5920596 100644 --- a/my_config.example.js +++ b/my_config.example.js @@ -338,6 +338,11 @@ module.exports = Object.freeze({ */ partition_id: 0, + /** + * - 是否不为抽奖UP单独设置关注分区 + */ + is_not_create_partition: false, + /** * 是否关注异常 */