feat: 关注分区移动可关闭 (#228)

Fixed #228
This commit is contained in:
shanmite 2023-01-03 12:38:58 +08:00
parent 5097f2af39
commit 0814154c7a
3 changed files with 25 additions and 8 deletions

View File

@ -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

View File

@ -332,6 +332,11 @@ const config = {
*/
partition_id: 0,
/**
* - 是否不为抽奖UP单独设置关注分区
*/
is_not_create_partition: false,
/**
* 是否关注异常
*/

View File

@ -338,6 +338,11 @@ module.exports = Object.freeze({
*/
partition_id: 0,
/**
* - 是否不为抽奖UP单独设置关注分区
*/
is_not_create_partition: false,
/**
* 是否关注异常
*/