Skip to content

Commit

Permalink
feat: 清理新增clear_white_list设置
Browse files Browse the repository at this point in the history
  • Loading branch information
shanmite committed Jul 18, 2021
1 parent ce3274c commit a21b0dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
6 changes: 0 additions & 6 deletions env.example.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* 使用时请将此文件命名为env.js
* RELEASE内可执行文件包中已有env.js文件
* 注: 请打开扩展名显示
*/

/**
* ## 账号相关
* - `COOKIE` 是必填项
Expand Down
10 changes: 5 additions & 5 deletions lib/clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

/**动态偏移量 */
Expand All @@ -25,16 +24,16 @@ 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;
}

/**
* 清理动态和关注
*/
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) {
Expand Down Expand Up @@ -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)
}

Expand Down
16 changes: 9 additions & 7 deletions my_config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

/**
* 转发评语
*/
Expand Down Expand Up @@ -164,6 +160,12 @@ module.exports = {
*/
is_exception: false,

/**
* - 清理白名单uid或dyid
* - 英文逗号分隔 如: 1,2,3
*/
clear_white_list: '',

/**
* - 取关分区
* - 默认为: 此处存放因抽奖临时关注的up
Expand Down

0 comments on commit a21b0dd

Please sign in to comment.