From 50c22a4ecf5f1c213263e23d0d706f8672523abc Mon Sep 17 00:00:00 2001 From: shanmite Date: Sun, 12 Feb 2023 11:27:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B4=A6=E5=8F=B7=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=82=B9=E8=B5=9E=E5=A4=B1=E8=B4=A5=20(#247)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed #247 --- lib/core/monitor.js | 29 ++++++++++++++++++----------- lib/data/config.js | 2 +- lib/net/bili.js | 4 ++++ my_config.example.js | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/lib/core/monitor.js b/lib/core/monitor.js index 182ad26..344a21c 100644 --- a/lib/core/monitor.js +++ b/lib/core/monitor.js @@ -65,11 +65,12 @@ class Monitor extends Searcher { event_bus.emit('Turn_off_the_Monitor', '分区移动出错') break; case 2004: - log.warn('账号异常', `UID(${global_var.get('myUID')})异常号只会对部分UP出现关注异常`) + case 4005: + log.warn(`账号异常${status}`, `UID(${global_var.get('myUID')})异常号只会对部分UP出现异常`) if (!config.is_exception) { await sendNotify( - '[动态抽奖]账号异常通知', - `UID: ${global_var.get('myUID')}\n异常号只会对部分UP出现关注异常\n可在设置中令is_exception为true关闭此推送\n${log._cache.filter(it => /Error|\s抽奖信息\]/.test(it)).join('\n')}` + `[动态抽奖]账号异常${status}通知`, + `UID: ${global_var.get('myUID')}\n异常号只会对部分UP出现异常\n可在设置中令is_exception为true关闭此推送\n${log._cache.filter(it => /Error|\s抽奖信息\]/.test(it)).join('\n')}` ) } config.is_exception = true; @@ -206,6 +207,9 @@ class Monitor extends Searcher { case 2004: is_exception = 2004 break; + case 4005: + is_exception = 4005 + break; case 2005: is_outof_maxfollow = 2005 break; @@ -573,6 +577,7 @@ class Monitor extends Searcher { * - 点赞 点赞异常 4002 * - 点赞 点赞频繁 4003 * - 点赞 已赞过 4004 + * - 点赞 账号异常,点赞失败 4005 * - 转发 未知错误 5001 * - 转发 该动态不能转发分享 5002 * - 转发 请求数据发生错误,请刷新或稍后重试 5003 @@ -661,15 +666,17 @@ class Monitor extends Searcher { } /* 转发 */ - status = await retryfn( - 5, - [1, 3, 4], - () => bili.autoRelay(global_var.get("myUID"), dyid, relay_chat, ctrl) - ) + if (dyid) { + status = await retryfn( + 5, + [1, 3, 4], + () => bili.autoRelay(global_var.get("myUID"), dyid, relay_chat, ctrl) + ) - if (status) { - log.warn("抽奖信息", `dyid: ${dyid}`) - return 5000 + status + if (status) { + log.warn("抽奖信息", `dyid: ${dyid}`) + return 5000 + status + } } return status diff --git a/lib/data/config.js b/lib/data/config.js index 7217b6b..5e8ff55 100644 --- a/lib/data/config.js +++ b/lib/data/config.js @@ -348,7 +348,7 @@ const config = { is_not_create_partition: false, /** - * 是否关注异常 + * 是否异常 */ is_exception: false, diff --git a/lib/net/bili.js b/lib/net/bili.js index f843f36..7209922 100644 --- a/lib/net/bili.js +++ b/lib/net/bili.js @@ -737,6 +737,7 @@ const bili_client = { * - 点赞异常 2 * - 点赞频繁 3 * - 已赞过 4 + * - 账号异常,点赞失败 5 */ async autolike(dyid) { const @@ -763,6 +764,9 @@ const bili_client = { case 65006: log.warn('自动点赞', '已赞过'); return 4; + case 4128014: + log.warn('自动点赞', '账号异常,点赞失败'); + return 5; default: log.error('自动点赞', `未知错误\n${responseText}`); return 1; diff --git a/my_config.example.js b/my_config.example.js index b9ab8a3..4e5478c 100644 --- a/my_config.example.js +++ b/my_config.example.js @@ -357,7 +357,7 @@ module.exports = Object.freeze({ is_not_create_partition: false, /** - * 是否关注异常 + * 是否异常 */ is_exception: false,