mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
parent
b36d24a4d8
commit
1eaa188374
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
node_modules/
|
||||
.vscode/
|
||||
tests/
|
||||
dyids/
|
||||
dist/
|
||||
|
||||
@ -69,13 +69,13 @@ async function clear() {
|
||||
next_offset = offset;
|
||||
for (const [index, dyinfo] of allModifyDynamicResArray.entries()) {
|
||||
log.info('清理动态', `第${page + 1}页中的第${index + 1}个动态`)
|
||||
const { type, dynamic_id, createtime, origin_uid } = dyinfo || {};
|
||||
const { type, dynamic_id, create_time, origin_uid } = dyinfo || {};
|
||||
if (typeof type !== 'undefined'
|
||||
&& clear_dynamic_type instanceof Array
|
||||
? clear_dynamic_type.includes(type)
|
||||
: clear_dynamic_type === type
|
||||
) {
|
||||
const days_ago = (Now - createtime) / 86400;
|
||||
const days_ago = (Now - create_time) / 86400;
|
||||
|
||||
if (days_ago > clear_max_day) {
|
||||
/* 移除动态 */
|
||||
|
||||
@ -171,6 +171,9 @@ class Monitor extends Searcher {
|
||||
*/
|
||||
async filterLotteryInfo() {
|
||||
const { lottery_param, LotteryInfoMap, attentionList } = this;
|
||||
/**
|
||||
* @type {import("./searcher").LotteryInfo}
|
||||
*/
|
||||
let protoLotteryInfo = await LotteryInfoMap.get(lottery_param[0])(lottery_param[1]);
|
||||
|
||||
if (protoLotteryInfo === null)
|
||||
@ -182,9 +185,13 @@ class Monitor extends Searcher {
|
||||
|
||||
/** 所有抽奖信息 */
|
||||
let alllotteryinfo = [];
|
||||
const { key_words, model, chatmodel, is_imitator, only_followed, at_users, blockword, blacklist } = config;
|
||||
const
|
||||
{ key_words, model, chatmodel, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist } = config,
|
||||
now_ts = Date.now() / 1000;
|
||||
|
||||
/**Map<String, Boolean> */
|
||||
/**
|
||||
* @type {Map<String, Boolean>}
|
||||
*/
|
||||
let dyids_map = new Map();
|
||||
|
||||
/**去重 */
|
||||
@ -199,13 +206,16 @@ class Monitor extends Searcher {
|
||||
/* 检查动态是否满足要求 */
|
||||
await try_for_each(protoLotteryInfo, async function ({
|
||||
lottery_info_type, is_liked,
|
||||
uids, uname, dyid,
|
||||
uids, uname, dyid, create_time,
|
||||
ctrl, rid, des, type,
|
||||
hasOfficialLottery
|
||||
}) {
|
||||
/* 遇到转发过就退出 */
|
||||
if (is_liked) return false;
|
||||
|
||||
/* 超过指定时间退出 */
|
||||
if (now_ts - create_time > max_create_time * 86400) return false;
|
||||
|
||||
const
|
||||
/**判断是转发源动态还是现动态 */
|
||||
uid = lottery_info_type === 'uid' ? uids[1] : uids[0],
|
||||
|
||||
@ -11,14 +11,14 @@ const { log } = utils
|
||||
* @property {number} uid
|
||||
* @property {string} uname
|
||||
* @property {boolean} is_liked
|
||||
* @property {number} createtime 10
|
||||
* @property {number} create_time 10
|
||||
* @property {string} rid_str
|
||||
* @property {string} dynamic_id
|
||||
* @property {number} type
|
||||
* @property {string} description
|
||||
* @property {boolean} hasOfficialLottery
|
||||
* @property {Array<Object.<string,string|number>>} ctrl
|
||||
*
|
||||
* @property {number} origin_create_time 10
|
||||
* @property {number} origin_uid
|
||||
* @property {string} origin_uname
|
||||
* @property {string} origin_rid_str
|
||||
@ -27,6 +27,20 @@ const { log } = utils
|
||||
* @property {string} origin_description
|
||||
* @property {boolean} origin_hasOfficialLottery
|
||||
*
|
||||
* 整理后的抽奖信息
|
||||
* @typedef {object} LotteryInfo
|
||||
* @property {string} lottery_info_type
|
||||
* @property {number} create_time
|
||||
* @property {boolean} is_liked
|
||||
* @property {number[]} uids `[uid,ouid]`
|
||||
* @property {string} uname
|
||||
* @property {Array<{}>} ctrl
|
||||
* @property {string} dyid
|
||||
* @property {string} rid
|
||||
* @property {string} des
|
||||
* @property {number} type
|
||||
* @property {boolean} hasOfficialLottery 是否官方
|
||||
*
|
||||
* @param {object} dynamic_detail_card
|
||||
* @return {UsefulDynamicInfo}
|
||||
*/
|
||||
@ -46,7 +60,7 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
/* 动态是否点过赞 */
|
||||
obj.is_liked = is_liked > 0
|
||||
/* 动态的ts10 */
|
||||
obj.createtime = desc.timestamp
|
||||
obj.create_time = desc.timestamp
|
||||
/* 动态类型 */
|
||||
obj.type = desc.type
|
||||
/* 用于发送评论 */
|
||||
@ -65,6 +79,8 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
const { origin_extension, origin } = cardToJson
|
||||
, originToJson = strToJson(origin)
|
||||
, { user, item } = originToJson;
|
||||
/* 源动态的ts10 */
|
||||
obj.origin_create_time = desc.origin.timestamp;
|
||||
/* 被转发者的UID */
|
||||
obj.origin_uid = desc.origin.uid;
|
||||
/* 被转发者的rid(用于发评论) */
|
||||
@ -131,20 +147,6 @@ function modifyDynamicRes(res) {
|
||||
*/
|
||||
class Searcher {
|
||||
constructor() { }
|
||||
/**
|
||||
* 整理后的抽奖信息
|
||||
* @typedef {object} LotteryInfo
|
||||
* @property {string} lottery_info_type
|
||||
* @property {boolean} is_liked
|
||||
* @property {number[]} uids `[uid,ouid]`
|
||||
* @property {string} uname
|
||||
* @property {Array<{}>} ctrl
|
||||
* @property {string} dyid
|
||||
* @property {string} rid
|
||||
* @property {string} des
|
||||
* @property {number} type
|
||||
* @property {boolean} hasOfficialLottery 是否官方
|
||||
*/
|
||||
/**
|
||||
* 检查指定用户的所有的动态信息
|
||||
* @param {number} hostuid 指定的用户UID
|
||||
@ -247,6 +249,7 @@ class Searcher {
|
||||
|
||||
return [...results, {
|
||||
lottery_info_type: 'uid',
|
||||
create_time: cur.origin_create_time,
|
||||
is_liked,
|
||||
uids: [cur.uid, cur.origin_uid],
|
||||
uname: cur.origin_uname,
|
||||
@ -307,6 +310,7 @@ class Searcher {
|
||||
const fomatdata = mDRdata.map(o => {
|
||||
return {
|
||||
lottery_info_type: 'tag',
|
||||
create_time: o.create_time,
|
||||
is_liked: o.is_liked,
|
||||
uids: [o.uid, o.origin_uid],
|
||||
uname: o.uname,
|
||||
@ -386,6 +390,7 @@ class Searcher {
|
||||
const fomatdata = dyinfos.map(o => {
|
||||
return {
|
||||
lottery_info_type: 'article',
|
||||
create_time: o.create_time,
|
||||
is_liked: o.is_liked,
|
||||
uids: [o.uid, o.origin_uid],
|
||||
uname: o.uname,
|
||||
|
||||
@ -41,6 +41,12 @@ const config = {
|
||||
*/
|
||||
chatmodel: '01',
|
||||
|
||||
/**
|
||||
* - 动态创建时间
|
||||
* - 多少天前
|
||||
*/
|
||||
max_create_time: 60,
|
||||
|
||||
/**
|
||||
* 不加判断的转发所监视的uid转发的动态
|
||||
*/
|
||||
|
||||
@ -53,6 +53,12 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
chatmodel: '01',
|
||||
|
||||
/**
|
||||
* - 动态创建时间
|
||||
* - 多少天前
|
||||
*/
|
||||
max_create_time: 60,
|
||||
|
||||
/**
|
||||
* 不加判断的转发所监视的uid转发的动态
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user