From 0630c8931a3846fba0ddc8b99d4b508e28537d8e Mon Sep 17 00:00:00 2001 From: shanmite Date: Sun, 12 Feb 2023 13:04:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=8A=84=E7=83=AD=E8=AF=84=E5=B1=8F=E8=94=BD=E8=AF=8D=20(#239)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed #239 --- lib/core/monitor.js | 7 +++++-- lib/data/config.js | 5 +++++ my_config.example.js | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/core/monitor.js b/lib/core/monitor.js index 3be1b34..79b8db8 100644 --- a/lib/core/monitor.js +++ b/lib/core/monitor.js @@ -593,12 +593,15 @@ class Monitor extends Searcher { let status = 0, { uid, dyid, chat_type, rid, relay_chat, ctrl, chat } = option, - { check_if_duplicated, is_copy_chat, is_repost_then_chat, is_not_create_partition } = config; + { check_if_duplicated, is_copy_chat, copy_blockword, is_repost_then_chat, is_not_create_partition } = config; /* 评论 */ if (rid && chat_type) { if (is_copy_chat) { - const copy_chat = getRandomOne(await bili.getChat(rid, chat_type)); + const copy_chat = getRandomOne( + (await bili.getChat(rid, chat_type)) + .filter(it => !(new RegExp(copy_blockword.join('|')).test(it[1]))) + ); chat = copy_chat[1] .replace( new RegExp(copy_chat[0], 'g'), diff --git a/lib/data/config.js b/lib/data/config.js index 5e8ff55..3847872 100644 --- a/lib/data/config.js +++ b/lib/data/config.js @@ -336,6 +336,11 @@ const config = { */ is_copy_chat: false, + /** + * 热评屏蔽词 + */ + copy_blockword: [], + /** * - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid) * - 自动获取 diff --git a/my_config.example.js b/my_config.example.js index 4e5478c..a980ab0 100644 --- a/my_config.example.js +++ b/my_config.example.js @@ -345,6 +345,11 @@ module.exports = Object.freeze({ */ is_copy_chat: false, + /** + * 热评屏蔽词 + */ + copy_blockword: ["三不原则"], + /** * - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid) * - 自动获取