fix: 点赞失败(#7)

feat: 新增设置
This commit is contained in:
shanmite 2021-07-30 17:24:51 +08:00
parent fdee933ca4
commit d2d9d31ebf
5 changed files with 27 additions and 17 deletions

View File

@ -62,15 +62,12 @@ class Monitor extends Public {
eventBus.emit('Turn_on_the_Monitor')
break
case 31:
eventBus.emit('Turn_on_the_Monitor')
break
case 41:
eventBus.emit('Turn_off_the_Monitor', '转发失败')
break
case 51:
case 41:
eventBus.emit('Turn_off_the_Monitor', '获取开奖时间失败')
break
case 61:
case 51:
eventBus.emit('Turn_off_the_Monitor', '获取关注数失败')
break
default:
@ -95,7 +92,7 @@ class Monitor extends Public {
let { ts } = await BiliAPI.getLotteryNotice(Lottery.dyid);
const ts_10 = Date.now() / 1000;
if (ts < 0) {
return 51
return 41
}
if (ts < ts_10) {
log.info('过滤', '已过开奖时间')
@ -110,7 +107,7 @@ class Monitor extends Public {
} else if (Lottery.uid[0]) {
const followerNum = await BiliAPI.getUserInfo(Lottery.uid[0]);
if (followerNum < 0) {
return 61
return 51
}
if (followerNum < config.minfollower) {
log.info('过滤', `粉丝数(${followerNum})小于指定数量`)
@ -314,8 +311,7 @@ class Monitor extends Public {
* 11 - 评论错误
* 21 - 关注错误
* 22 - 关注异常
* 31 - 点赞失败
* 41 - 转发失败
* 31 - 转发失败
*/
async go(option) {
log.debug('正在转发的动态信息', option);
@ -356,10 +352,10 @@ class Monitor extends Public {
}
/* 点赞 */
if (await BiliAPI.autolike(dyid)) return 31;
await BiliAPI.autolike(dyid)
/* 转发 */
if (await BiliAPI.autoRelay(GlobalVar.get("myUID"), dyid, relay_chat, ctrl)) return 41;
if (await BiliAPI.autoRelay(GlobalVar.get("myUID"), dyid, relay_chat, ctrl)) return 31;
return 0
}

View File

@ -30,7 +30,7 @@ async function getFollowList() {
* 清理动态和关注
*/
async function clear() {
const { clear_white_list, clear_max_day, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type } = config;
const { clear_white_list, clear_max_day, clear_quick_remove_attention, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type } = config;
let success = true;
const uid_list = await getFollowList();
if (!uid_list.length) {
@ -38,7 +38,7 @@ async function clear() {
} else {
log.info('清理关注', `共有${uid_list.length}个关注`)
}
if (!clear_remove_dynamic && clear_remove_attention) {
if (clear_quick_remove_attention) {
log.info('清理关注', '进入只清理关注模式')
/* 专清关注 */
for (const [index, uid] of uid_list.entries()) {

View File

@ -78,7 +78,7 @@ async function isMe() {
desp += `${business}中@了你(${GlobalVar.get("myUID")}) \n\n`
desp += `原内容为: ${source_content} \n\n`
desp += `[直达链接](${url}) \n\n`
desp += `\n\n\n\n`
desp += `\n\n`
});
log.info('中奖检测', '--> OK');
}
@ -93,12 +93,12 @@ async function isMe() {
if (talker_id) {
BiliAPI.updateSessionStatus(talker_id);
await Util.delay(1000);
if (/中奖|获得|填写|写上|提供|收货地址|支付宝账号|码|大会员/.test(content)) {
if (config.notice_key_words.some(it => new RegExp(it).test(content))) {
desp += `发生时间: ${new Date(timestamp * 1000).toLocaleString()} \n\n`
desp += `用户: ${sender_uid} \n\n`
desp += `私信你(${GlobalVar.get("myUID")})说: ${content} \n\n`
desp += `[直达链接](https://message.bilibili.com/#/whisper/mid${sender_uid}) \n\n`
desp += `\n\n\n\n`
desp += `\n\n`
}
}
}

View File

@ -10,7 +10,7 @@ const metainfo = [
` __/ | | | `,
` |___/ |_| `,
` `,
` v2.0.0 by shanmite`,
` v2.0.1 by shanmite`,
]
/**多账号存储 */
let multiple_account = [];

View File

@ -177,6 +177,14 @@ module.exports = {
*/
is_exception: false,
/**
* 中奖通知关键词(满足一个就推送)
* 符合js正则表达式的字符串
*/
notice_key_words: [
"中奖", "获得", "填写", "写上", "提供", "收货地址", "支付宝账号", "码", "大会员"
],
/**
* - 清理白名单uid或dyid
* - 英文逗号分隔 : 1,2,3
@ -194,6 +202,12 @@ module.exports = {
*/
clear_max_day: 30,
/**
* - 快速移除关注
* - 不加判断只去除关注
*/
clear_quick_remove_attention: false,
/**
* 是否移除动态
*/