mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
parent
00b5310b59
commit
3e01e423b7
@ -303,7 +303,7 @@ class Monitor extends Searcher {
|
|||||||
await try_for_each(protoLotteryInfo, async function (lottery_info) {
|
await try_for_each(protoLotteryInfo, async function (lottery_info) {
|
||||||
const {
|
const {
|
||||||
lottery_info_type, is_liked,
|
lottery_info_type, is_liked,
|
||||||
uids, uname, dyid, reserve_id, create_time,
|
uids, uname, dyid, reserve_id, reserve_lottery_text, create_time,
|
||||||
ctrl, rid, des, type,
|
ctrl, rid, des, type,
|
||||||
hasOfficialLottery
|
hasOfficialLottery
|
||||||
} = lottery_info;
|
} = lottery_info;
|
||||||
@ -342,7 +342,7 @@ class Monitor extends Searcher {
|
|||||||
needTopic = [...new Set(description.match(/(?<=[带加上](?:话题|tag).*)#.+?#|(?<=[带加上])#.+?#(?=话题|tag)/ig) || [])].join(' '),
|
needTopic = [...new Set(description.match(/(?<=[带加上](?:话题|tag).*)#.+?#|(?<=[带加上])#.+?#(?=话题|tag)/ig) || [])].join(' '),
|
||||||
isRelayDynamic = type === 1,
|
isRelayDynamic = type === 1,
|
||||||
has_key_words = key_words.every(it => new RegExp(it).test(description)),
|
has_key_words = key_words.every(it => new RegExp(it).test(description)),
|
||||||
isBlock = new RegExp(blockword.join('|')).test(description),
|
isBlock = new RegExp(blockword.join('|')).test(description + reserve_lottery_text),
|
||||||
isLottery =
|
isLottery =
|
||||||
(is_imitator && lottery_info_type === 'uid' && model !== '00')
|
(is_imitator && lottery_info_type === 'uid' && model !== '00')
|
||||||
|| (hasOfficialLottery && model[0] === '1')
|
|| (hasOfficialLottery && model[0] === '1')
|
||||||
@ -368,43 +368,6 @@ class Monitor extends Searcher {
|
|||||||
|
|
||||||
log.debug("筛选动态", { real_uid, mIsFollowed, oriIsFollowed, realIsFollowed, needAt, needTopic, type, 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 (reserve_id) {
|
|
||||||
if (disable_reserve_lottery) {
|
|
||||||
log.info("已关闭预约抽奖功能")
|
|
||||||
} else {
|
|
||||||
log.info("预约抽奖", "开始");
|
|
||||||
if (hasEnv('NOT_GO_LOTTERY')) {
|
|
||||||
log.info('NOT_GO_LOTTERY', 'ON');
|
|
||||||
} else {
|
|
||||||
await bili.reserve_lottery(reserve_id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!has_key_words && description) {
|
|
||||||
log.warn("筛选动态", `无关键词动态的描述: ${description}\n\n考虑是否修改设置key_words:\n${key_words.join('\n')}`)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**屏蔽词 */
|
|
||||||
if (isBlock) {
|
|
||||||
log.info("筛选动态", `包含屏蔽词(https://t.bilibili.com/${dyid})`)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**若勾选只转已关注 */
|
|
||||||
if (only_followed
|
|
||||||
&& (!mIsFollowed || !oriIsFollowed)
|
|
||||||
) {
|
|
||||||
log.info("筛选动态", `只转已关注(https://t.bilibili.com/${dyid})`)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
new_blacklist.some(id => keys.some(key => {
|
new_blacklist.some(id => keys.some(key => {
|
||||||
if (key + '' === id) {
|
if (key + '' === id) {
|
||||||
@ -418,6 +381,44 @@ class Monitor extends Searcher {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (block_dynamic_type.includes(type)) {
|
||||||
|
log.warn("筛选动态", `屏蔽动态类型 ${type}`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**屏蔽词 */
|
||||||
|
if (isBlock) {
|
||||||
|
log.info("筛选动态", `包含屏蔽词(https://t.bilibili.com/${dyid})`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reserve_id) {
|
||||||
|
if (disable_reserve_lottery) {
|
||||||
|
log.info("已关闭预约抽奖功能")
|
||||||
|
} else {
|
||||||
|
log.info("预约抽奖", "开始");
|
||||||
|
log.info("预约抽奖", `奖品: ${reserve_lottery_text}`);
|
||||||
|
if (hasEnv('NOT_GO_LOTTERY')) {
|
||||||
|
log.info('NOT_GO_LOTTERY', 'ON');
|
||||||
|
} else {
|
||||||
|
await bili.reserve_lottery(reserve_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_key_words && description) {
|
||||||
|
log.warn("筛选动态", `无关键词动态的描述: ${description}\n\n考虑是否修改设置key_words:\n${key_words.join('\n且满足: ')}`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**若勾选只转已关注 */
|
||||||
|
if (only_followed
|
||||||
|
&& (!mIsFollowed || !oriIsFollowed)
|
||||||
|
) {
|
||||||
|
log.info("筛选动态", `只转已关注(https://t.bilibili.com/${dyid})`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if (isLottery) {
|
if (isLottery) {
|
||||||
const { uname_map = {} } = global_var.get("remoteconfig")
|
const { uname_map = {} } = global_var.get("remoteconfig")
|
||||||
let onelotteryinfo = {};
|
let onelotteryinfo = {};
|
||||||
|
|||||||
@ -18,7 +18,8 @@ const { log } = utils
|
|||||||
* @property {string} dynamic_id
|
* @property {string} dynamic_id
|
||||||
* @property {number} type
|
* @property {number} type
|
||||||
* @property {string} description
|
* @property {string} description
|
||||||
* @property {number} reserve_id
|
* @property {string} reserve_id
|
||||||
|
* @property {string} reserve_lottery_text
|
||||||
* @property {boolean} hasOfficialLottery
|
* @property {boolean} hasOfficialLottery
|
||||||
* @property {Array<Object.<string,string|number>>} ctrl
|
* @property {Array<Object.<string,string|number>>} ctrl
|
||||||
* @property {number} origin_create_time 10
|
* @property {number} origin_create_time 10
|
||||||
@ -28,7 +29,8 @@ const { log } = utils
|
|||||||
* @property {string} origin_dynamic_id
|
* @property {string} origin_dynamic_id
|
||||||
* @property {number} orig_type
|
* @property {number} orig_type
|
||||||
* @property {string} origin_description
|
* @property {string} origin_description
|
||||||
* @property {number} origin_reserve_id
|
* @property {string} origin_reserve_id
|
||||||
|
* @property {string} origin_reserve_lottery_text
|
||||||
* @property {boolean} origin_hasOfficialLottery
|
* @property {boolean} origin_hasOfficialLottery
|
||||||
*
|
*
|
||||||
* 整理后的抽奖信息
|
* 整理后的抽奖信息
|
||||||
@ -40,7 +42,8 @@ const { log } = utils
|
|||||||
* @property {string} uname
|
* @property {string} uname
|
||||||
* @property {Array<{}>} ctrl
|
* @property {Array<{}>} ctrl
|
||||||
* @property {string} dyid
|
* @property {string} dyid
|
||||||
* @property {number} reserve_id
|
* @property {string} reserve_id
|
||||||
|
* @property {string} reserve_lottery_text
|
||||||
* @property {string} rid
|
* @property {string} rid
|
||||||
* @property {string} des
|
* @property {string} des
|
||||||
* @property {number} type
|
* @property {number} type
|
||||||
@ -53,12 +56,12 @@ function parseDynamicCard(dynamic_detail_card) {
|
|||||||
const { strToJson } = utils;
|
const { strToJson } = utils;
|
||||||
/**临时储存单个动态中的信息 */
|
/**临时储存单个动态中的信息 */
|
||||||
let obj = {};
|
let obj = {};
|
||||||
const { desc, card, extension, extend_json } = dynamic_detail_card
|
const { desc, card, extension, extend_json, display = {} } = dynamic_detail_card
|
||||||
, { is_liked = 1, user_profile = {} } = desc
|
, { is_liked = 1, user_profile = {} } = desc
|
||||||
, { info = {} } = user_profile
|
, { info = {} } = user_profile
|
||||||
, extendjsonToJson = strToJson(extend_json)
|
|
||||||
, extendjsonToJsonHidden = extendjsonToJson[""] || {}
|
|
||||||
, cardToJson = strToJson(card)
|
, cardToJson = strToJson(card)
|
||||||
|
, extendjsonToJson = strToJson(extend_json)
|
||||||
|
, { add_on_card_info = [] } = display
|
||||||
, { item } = cardToJson;
|
, { item } = cardToJson;
|
||||||
/* 转发者的UID */
|
/* 转发者的UID */
|
||||||
obj.uid = desc.uid
|
obj.uid = desc.uid
|
||||||
@ -79,17 +82,18 @@ function parseDynamicCard(dynamic_detail_card) {
|
|||||||
/* 定位@信息 */
|
/* 定位@信息 */
|
||||||
obj.ctrl = (extendjsonToJson.ctrl) || [];
|
obj.ctrl = (extendjsonToJson.ctrl) || [];
|
||||||
/* 预约抽奖信息 */
|
/* 预约抽奖信息 */
|
||||||
if (extendjsonToJsonHidden.reserve) {
|
if (add_on_card_info.length > 0) {
|
||||||
let status = (((dynamic_detail_card || {})
|
const [status, oid_str, text] = add_on_card_info
|
||||||
.display || {})
|
.filter(it => typeof it.reserve_attach_card !== 'undefined'
|
||||||
.add_on_card_info || [])
|
&& typeof it.reserve_attach_card.reserve_lottery !== 'undefined'
|
||||||
.map(it => (((it || {})
|
&& typeof it.reserve_attach_card.reserve_button !== 'undefined')
|
||||||
.reserve_attach_card || {})
|
.map(({ reserve_attach_card }) => [
|
||||||
.reserve_button || {})
|
reserve_attach_card.reserve_button.status,
|
||||||
.status || 2)[0];
|
reserve_attach_card.oid_str,
|
||||||
|
reserve_attach_card.reserve_lottery.text])[0] || [];
|
||||||
if (status === 1) {
|
if (status === 1) {
|
||||||
let { reserve_id } = extendjsonToJsonHidden.reserve;
|
obj.reserve_id = oid_str;
|
||||||
obj.reserve_id = reserve_id || 0;
|
obj.reserve_lottery_text = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 是否有官方抽奖 */
|
/* 是否有官方抽奖 */
|
||||||
@ -100,9 +104,9 @@ function parseDynamicCard(dynamic_detail_card) {
|
|||||||
|| (cardToJson.dynamic || '' + cardToJson.desc || '')
|
|| (cardToJson.dynamic || '' + cardToJson.desc || '')
|
||||||
|| '';
|
|| '';
|
||||||
if (obj.type === 1) {
|
if (obj.type === 1) {
|
||||||
const { origin_extension, origin, origin_extend_json } = cardToJson
|
const { origin_extension, origin } = cardToJson
|
||||||
, originToJson = strToJson(origin)
|
, originToJson = strToJson(origin)
|
||||||
, originextendjsonToJson = strToJson(origin_extend_json)
|
, { add_on_card_info = [] } = display.origin || {}
|
||||||
, { user, item } = originToJson;
|
, { user, item } = originToJson;
|
||||||
/* 源动态的ts10 */
|
/* 源动态的ts10 */
|
||||||
obj.origin_create_time = desc.origin.timestamp;
|
obj.origin_create_time = desc.origin.timestamp;
|
||||||
@ -113,9 +117,19 @@ function parseDynamicCard(dynamic_detail_card) {
|
|||||||
/* 被转发者的动态的ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
/* 被转发者的动态的ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||||
obj.origin_dynamic_id = desc.orig_dy_id_str;
|
obj.origin_dynamic_id = desc.orig_dy_id_str;
|
||||||
/* 预约抽奖信息 */
|
/* 预约抽奖信息 */
|
||||||
if (originextendjsonToJson.reserve) {
|
if (add_on_card_info.length > 0) {
|
||||||
let { reserve_id, reserve_lottery } = originextendjsonToJson.reserve;
|
const [status, oid_str, text] = add_on_card_info
|
||||||
obj.origin_reserve_id = reserve_lottery === 1 ? reserve_id : 0;
|
.filter(it => typeof it.reserve_attach_card !== 'undefined'
|
||||||
|
&& typeof it.reserve_attach_card.reserve_lottery !== 'undefined'
|
||||||
|
&& typeof it.reserve_attach_card.reserve_button !== 'undefined')
|
||||||
|
.map(({ reserve_attach_card }) => [
|
||||||
|
reserve_attach_card.reserve_button.status,
|
||||||
|
reserve_attach_card.oid_str,
|
||||||
|
reserve_attach_card.reserve_lottery.text])[0] || [];
|
||||||
|
if (status === 1) {
|
||||||
|
obj.origin_reserve_id = oid_str;
|
||||||
|
obj.origin_reserve_lottery_text = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* 是否有官方抽奖 */
|
/* 是否有官方抽奖 */
|
||||||
obj.origin_hasOfficialLottery = origin_extension && origin_extension.lott;
|
obj.origin_hasOfficialLottery = origin_extension && origin_extension.lott;
|
||||||
@ -289,6 +303,7 @@ class Searcher {
|
|||||||
ctrl: [],
|
ctrl: [],
|
||||||
dyid: cur.origin_dynamic_id,
|
dyid: cur.origin_dynamic_id,
|
||||||
reserve_id: cur.origin_reserve_id,
|
reserve_id: cur.origin_reserve_id,
|
||||||
|
reserve_lottery_text: cur.origin_reserve_lottery_text,
|
||||||
rid: cur.origin_rid_str,
|
rid: cur.origin_rid_str,
|
||||||
des: cur.origin_description,
|
des: cur.origin_description,
|
||||||
type: cur.orig_type,
|
type: cur.orig_type,
|
||||||
@ -348,6 +363,7 @@ class Searcher {
|
|||||||
ctrl: o.ctrl,
|
ctrl: o.ctrl,
|
||||||
dyid: o.dynamic_id,
|
dyid: o.dynamic_id,
|
||||||
reserve_id: o.reserve_id,
|
reserve_id: o.reserve_id,
|
||||||
|
reserve_lottery_text: o.reserve_lottery_text,
|
||||||
rid: o.rid_str,
|
rid: o.rid_str,
|
||||||
des: o.description,
|
des: o.description,
|
||||||
type: o.type,
|
type: o.type,
|
||||||
@ -437,6 +453,7 @@ class Searcher {
|
|||||||
ctrl: o.ctrl,
|
ctrl: o.ctrl,
|
||||||
dyid: o.dynamic_id,
|
dyid: o.dynamic_id,
|
||||||
reserve_id: o.reserve_id,
|
reserve_id: o.reserve_id,
|
||||||
|
reserve_lottery_text: o.reserve_lottery_text,
|
||||||
rid: o.rid_str,
|
rid: o.rid_str,
|
||||||
des: o.description,
|
des: o.description,
|
||||||
type: o.type,
|
type: o.type,
|
||||||
|
|||||||
@ -26,6 +26,8 @@ const config = {
|
|||||||
* @property {string} uname
|
* @property {string} uname
|
||||||
* @property {Array<{}>} ctrl
|
* @property {Array<{}>} ctrl
|
||||||
* @property {string} dyid
|
* @property {string} dyid
|
||||||
|
* @property {string} reserve_id
|
||||||
|
* @property {string} reserve_lottery_text
|
||||||
* @property {string} rid
|
* @property {string} rid
|
||||||
* @property {string} des
|
* @property {string} des
|
||||||
* @property {number} type
|
* @property {number} type
|
||||||
|
|||||||
@ -38,7 +38,8 @@ module.exports = Object.freeze({
|
|||||||
* @property {string} uname
|
* @property {string} uname
|
||||||
* @property {Array<{}>} ctrl
|
* @property {Array<{}>} ctrl
|
||||||
* @property {string} dyid
|
* @property {string} dyid
|
||||||
* @property {number} reserve_id
|
* @property {string} reserve_id
|
||||||
|
* @property {string} reserve_lottery_text
|
||||||
* @property {string} rid
|
* @property {string} rid
|
||||||
* @property {string} des
|
* @property {string} des
|
||||||
* @property {number} type
|
* @property {number} type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user