feat: 新增设置抄热评屏蔽词 (#239)

Fixed #239
This commit is contained in:
shanmite 2023-02-12 13:04:03 +08:00
parent 7b9d251e80
commit 0630c8931a
3 changed files with 15 additions and 2 deletions

View File

@ -593,12 +593,15 @@ class Monitor extends Searcher {
let let
status = 0, status = 0,
{ uid, dyid, chat_type, rid, relay_chat, ctrl, chat } = option, { 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 (rid && chat_type) {
if (is_copy_chat) { 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] chat = copy_chat[1]
.replace( .replace(
new RegExp(copy_chat[0], 'g'), new RegExp(copy_chat[0], 'g'),

View File

@ -336,6 +336,11 @@ const config = {
*/ */
is_copy_chat: false, is_copy_chat: false,
/**
* 热评屏蔽词
*/
copy_blockword: [],
/** /**
* - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid) * - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid)
* - 自动获取 * - 自动获取

View File

@ -345,6 +345,11 @@ module.exports = Object.freeze({
*/ */
is_copy_chat: false, is_copy_chat: false,
/**
* 热评屏蔽词
*/
copy_blockword: ["三不原则"],
/** /**
* - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid) * - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid)
* - 自动获取 * - 自动获取