From a21b0dd33edd0c00987ac3de64a9d1de0ae07c14 Mon Sep 17 00:00:00 2001 From: shanmite Date: Sun, 18 Jul 2021 10:28:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B8=85=E7=90=86=E6=96=B0=E5=A2=9Ecle?= =?UTF-8?q?ar=5Fwhite=5Flist=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env.example.js | 6 ------ lib/clear.js | 10 +++++----- my_config.example.js | 16 +++++++++------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/env.example.js b/env.example.js index 53a928d14..0c2f8de5d 100644 --- a/env.example.js +++ b/env.example.js @@ -1,9 +1,3 @@ -/** - * 使用时请将此文件命名为env.js - * RELEASE内可执行文件包中已有env.js文件 - * 注: 请打开扩展名显示 - */ - /** * ## 账号相关 * - `COOKIE` 是必填项 diff --git a/lib/clear.js b/lib/clear.js index 179683bde..dc9b6afa7 100644 --- a/lib/clear.js +++ b/lib/clear.js @@ -2,7 +2,6 @@ const { log, delay } = require("./Base"); const BiliAPI = require("./BiliAPI"); const Public = require("./Public"); const GlobalVar = require('./GlobalVar'); -const { followWhiteList } = require("./config"); const config = require("./config"); /**动态偏移量 */ @@ -25,8 +24,8 @@ async function getFollowList() { if (!uids.length) break; rmup.push(...uids) } - return followWhiteList.length - ? rmup.filter(uid => followWhiteList.split(',').indexOf(String(uid)) === -1) + return config.clear_white_list.length + ? rmup.filter(uid => config.clear_white_list.split(',').indexOf(String(uid)) === -1) : rmup; } @@ -34,7 +33,7 @@ async function getFollowList() { * 清理动态和关注 */ async function clear() { - const { clear_max_day, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type } = config; + const { clear_white_list, clear_max_day, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type } = config; let success = true; const uid_list = await getFollowList(); if (!clear_remove_dynamic && clear_remove_attention) { @@ -64,7 +63,8 @@ async function clear() { if ((now - createtime) > 86400 * clear_max_day) { /* 移除动态 */ if (dynamic_id - && clear_remove_dynamic) { + && clear_remove_dynamic + && !(new RegExp(dynamic_id).test(clear_white_list))) { success = await BiliAPI.rmDynamic(dynamic_id) } diff --git a/my_config.example.js b/my_config.example.js index bae60d1de..3feed9d40 100644 --- a/my_config.example.js +++ b/my_config.example.js @@ -123,20 +123,16 @@ module.exports = { at_users: [['转发抽奖娘', 294887687], ['你的工具人老公', 100680137]], /** - * 同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json + * - 同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json + * - 英文逗号分隔 如: 1,2,3 */ - blacklist: '1,2', + blacklist: '', /** * 屏蔽词 */ blockword: ["脚本抽奖", "恭喜", "结果", "抽奖号", "钓鱼", "涨粉"], - /** - * 取关白名单 - */ - followWhiteList: '1,2', - /** * 转发评语 */ @@ -164,6 +160,12 @@ module.exports = { */ is_exception: false, + /** + * - 清理白名单uid或dyid + * - 英文逗号分隔 如: 1,2,3 + */ + clear_white_list: '', + /** * - 取关分区 * - 默认为: 此处存放因抽奖临时关注的up