Compare commits

...
5 Commits
9 changed files with 70 additions and 17 deletions
+1
View File
@@ -3,6 +3,7 @@ node_modules/
tests/
dyids/
dist/
.env
*.log
package-lock.json
env.js
+8
View File
@@ -1,5 +1,13 @@
<!-- markdownlint-disable MD036 MD024-->
# CHANGELOG
## 主要变化(2.4.5)
* ef969bb feat: 每组显示动态转发数(#97)
* 0cbacd6 feat: 推送携带帐号编号(#98)
* da75c8c feat: 增加设置屏蔽动态类型`block_dynamic_type`(#99)
* 548ad4b fix: pushplus更新域名(#93)
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.4.4)
* c486abf fix: 黑名单不起作用(#92)
+5 -4
View File
@@ -6,8 +6,9 @@ const bili = require('./net/bili')
/**
* 是否中奖
* @param {number} num
*/
async function isMe() {
async function isMe(num) {
let desp = '';
const
{ notice_key_words, update_session_wait, get_session_wait, check_session_pages } = config,
@@ -23,7 +24,7 @@ async function isMe() {
desp += '----------------------------------------------------------------\n\n'
desp += `发生时间: ${new Date(at_time * 1000).toLocaleString()}\n\n`
desp += `用户: ${up_uname}\n\n`
desp += `${business}中@了你(${global_var.get("myUID")})\n\n`
desp += `${business}中@了你(https://space.bilibili.com/${global_var.get("myUID")})\n\n`
desp += `原内容为: ${source_content}\n\n`
desp += `[直达链接](${url})\n\n`
desp += '----------------------------------------------------------------\n\n'
@@ -46,7 +47,7 @@ async function isMe() {
desp += '----------------------------------------------------------------\n\n'
desp += `发生时间: ${new Date(timestamp * 1000).toLocaleString()}\n\n`
desp += `用户: ${sender_uid}\n\n`
desp += `私信你(${global_var.get("myUID")})说:\n${content}\n\n`
desp += `私信你(https://space.bilibili.com/${global_var.get("myUID")})说:\n${content}\n\n`
desp += `[直达链接](https://message.bilibili.com/#/whisper/mid${sender_uid})\n\n`
desp += '----------------------------------------------------------------\n\n'
}
@@ -75,7 +76,7 @@ async function isMe() {
if (desp) {
desp += '中奖了别忘给脚本(https://github.com/shanmiteko/LotteryAutoScript)点一个Star哦, 赞助一两块也不是不可以‍_(:з」∠)_\n\n'
log.info('可能中奖了', desp);
await sendNotify('可能中奖了', desp);
await sendNotify(`帐号${num}可能中奖了`, desp);
} else {
log.info('中奖检测', "暂未中奖");
}
+23 -10
View File
@@ -103,11 +103,12 @@ class Monitor extends Searcher {
if (len) {
let
status = 0,
is_exception = 0,
is_outof_maxfollow = 0;
is_outof_maxfollow = 0,
relayed_nums = 0;
for (const [index, lottery] of shuffle(allLottery).entries()) {
let status = 0;
let is_shutdown = false;
if (
is_outof_maxfollow
&& lottery.uid.length
@@ -121,7 +122,8 @@ class Monitor extends Searcher {
let { ts } = await bili.getLotteryNotice(lottery.dyid);
const ts_10 = Date.now() / 1000;
if (ts < 0) {
return 6001
status = 6001
break;
}
if (ts < ts_10) {
log.info('过滤', '已过开奖时间')
@@ -140,7 +142,8 @@ class Monitor extends Searcher {
if (minfollower > 0) {
const followerNum = await bili.getUserInfo(lottery.uid[0]);
if (followerNum < 0) {
return 7001
status = 7001
break;
}
if (followerNum < minfollower) {
log.info('过滤', `粉丝数(${followerNum})小于指定数量`)
@@ -165,6 +168,8 @@ class Monitor extends Searcher {
status = await this.go(lottery)
switch (status) {
case 0:
relayed_nums += 1
break;
case 1002:
case 1003:
case 1004:
@@ -190,17 +195,20 @@ class Monitor extends Searcher {
case 2001:
case 3001:
case 5001:
return status
is_shutdown = true
break;
}
if (is_shutdown) break
d_storage.updateDyid(lottery.dyid)
await delay(wait * (Math.random() + 0.5));
}
log.info('抽奖', '开始转发下一组动态');
log.info('抽奖', `本轮共转发${relayed_nums}`);
return is_exception
|| is_outof_maxfollow
|| 0
|| status
} else {
log.info('抽奖', '无未转发抽奖');
return 0
@@ -236,7 +244,7 @@ class Monitor extends Searcher {
/** 所有抽奖信息 */
let alllotteryinfo = [];
const
{ check_if_duplicated, set_lottery_info_url, key_words, model, chatmodel, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist, use_public_blacklist } = config,
{ check_if_duplicated, set_lottery_info_url, key_words, model, chatmodel, block_dynamic_type, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist, use_public_blacklist } = config,
now_ts = Date.now() / 1000;
/**
@@ -354,7 +362,12 @@ class Monitor extends Searcher {
: blacklist.split(','),
keys = [dyid, m_uid, ori_uid];
log.debug("筛选动态", { real_uid, mIsFollowed, oriIsFollowed, realIsFollowed, needAt, needTopic, isRelayDynamic, key_words, has_key_words, blockword, isBlock, isLottery, isSendChat })
log.debug("筛选动态", { real_uid, mIsFollowed, oriIsFollowed, realIsFollowed, needAt, needTopic, type, isRelayDynamic, key_words, has_key_words, blockword, isBlock, isLottery, isSendChat })
if (block_dynamic_type.includes(type)) {
log.warn("筛选动态", `屏蔽动态类型 ${type}`)
return false
}
if (!has_key_words && description) {
log.warn("筛选动态", `无关键词动态的描述: ${description}\n\n考虑是否修改设置key_words:\n${key_words.join('\n')}`)
+15
View File
@@ -78,6 +78,21 @@ const config = {
*/
check_if_duplicated: 1,
/**
* 屏蔽动态类型
*
* | 动态类型 | type值 |
* | :------- |:----- |
* | 转发 | `1` |
* | 含图片 | `2` |
* | 无图纯文字 | `4` |
* | 视频 | `8` |
* | 番剧 | `512` |
* | 活动 | `2048` |
* | 专栏 | `64` |
*/
block_dynamic_type: [0],
/**
* - 动态创建时间
* - 多少天前
+1 -1
View File
@@ -621,7 +621,7 @@ function pushPlusNotify(text, desp) {
if (PUSH_PLUS_TOKEN) {
send({
method: 'POST',
url: 'https://pushplus.hxtrip.com/send',
url: 'http://www.pushplus.plus/send',
contents: {
token: PUSH_PLUS_TOKEN,
title: text,
+1 -1
View File
@@ -65,7 +65,7 @@ async function main() {
case 'check':
log.info('中奖检测', '检查是否中奖');
loop_wait = check_loop_wait;
await isMe();
await isMe(NUMBER);
break;
case 'clear':
if (CLEAR) {
+15
View File
@@ -92,6 +92,21 @@ module.exports = Object.freeze({
*/
check_if_duplicated: 1,
/**
* 屏蔽动态类型
*
* | 动态类型 | type值 |
* | :------- |:----- |
* | 转发 | `1` |
* | 含图片 | `2` |
* | 无图纯文字 | `4` |
* | 视频 | `8` |
* | 番剧 | `512` |
* | 活动 | `2048` |
* | 专栏 | `64` |
*/
block_dynamic_type: [0],
/**
* - 动态创建时间
* - 多少天前
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "lottery-auto-script",
"version": "2.4.4",
"version": "2.4.5",
"description": "自动参与B站动态抽奖",
"main": "main.js",
"scripts": {