mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
feat: 自动@两位用户
This commit is contained in:
parent
587f5bf56b
commit
6149819919
@ -99,7 +99,7 @@ const BiliAPI = {
|
||||
success: responseText => {
|
||||
let res = Base.strToJson(responseText);
|
||||
if (res.code === 0) {
|
||||
console.log('[获取私信]成功 end_ts:' + ts_16);
|
||||
console.log('[获取一页私信]成功 end_ts:' + ts_16);
|
||||
/**@type {Array} */
|
||||
const sessions = res.data.session_list || [];
|
||||
const has_more = res.data.has_more;
|
||||
|
||||
@ -92,18 +92,21 @@ class Monitor extends Public {
|
||||
if (isBlock) break;
|
||||
}
|
||||
if (isBlock) continue;
|
||||
const hasAt = /(?:@|艾特)[^@|(艾特)]*?好友/.test(description);
|
||||
const haslottery = /[抽奖]/.test(description);
|
||||
const hasGuanZhuan = /[转关].*[转关]/.test(description);
|
||||
if (hasOfficialLottery && model[0] === '1') {
|
||||
const oneLNotice = await BiliAPI.getLotteryNotice(dyid);
|
||||
ts = oneLNotice.ts;
|
||||
isLottery = ts > now_ts_10 && ts < now_ts_10 + maxday;
|
||||
isSendChat = chatmodel[0] === '1';
|
||||
} else if (!hasOfficialLottery && model[1] === '1') {
|
||||
if (!/[抽奖]/.test(description)) continue;
|
||||
if (!haslottery) continue;
|
||||
ts = Base.getLotteryNotice(description).ts;
|
||||
if (!official_verify) {
|
||||
const followerNum = await BiliAPI.getUserInfo(uid);
|
||||
if (followerNum < Number(minfollower)) continue;
|
||||
isLottery = /[转关].*[转关]/.test(description) && !befilter && (ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday));
|
||||
isLottery = hasGuanZhuan && !befilter && (ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday));
|
||||
} else {
|
||||
isLottery = ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday);
|
||||
}
|
||||
@ -125,27 +128,44 @@ class Monitor extends Public {
|
||||
if (!isFollowed) onelotteryinfo.uid.push(uid);
|
||||
if (!isRelay) {
|
||||
onelotteryinfo.dyid = dyid;
|
||||
const RandomStr = Base.getRandomStr(config.relay);
|
||||
let RandomStr = Base.getRandomStr(config.relay);
|
||||
let new_ctrl = [];
|
||||
if (hasAt) {
|
||||
/**如要修改请手动填写 */
|
||||
const _at = [
|
||||
['转发抽奖娘', 294887687],
|
||||
['你的工具人老公', 100680137]
|
||||
];
|
||||
_at.forEach(it => {
|
||||
new_ctrl.push({
|
||||
data: String(it[1]),
|
||||
location: RandomStr.length,
|
||||
length: it[0].length + 1,
|
||||
type: 1
|
||||
})
|
||||
RandomStr += '@' + it[0]
|
||||
})
|
||||
}
|
||||
if (type === 1) {
|
||||
/* 转发内容长度+'//'+'@'+用户名+':'+源内容 */
|
||||
const addlength = RandomStr.length + 2 + uname.length + 1 + 1;
|
||||
onelotteryinfo.relay_chat = RandomStr + `//@${uname}:` + des;
|
||||
let new_ctrl = ctrl.map(item => {
|
||||
item.location += addlength;
|
||||
return item;
|
||||
})
|
||||
new_ctrl.unshift({
|
||||
new_ctrl.push({
|
||||
data: String(uid),
|
||||
location: RandomStr.length + 2,
|
||||
length: uname.length + 1,
|
||||
type: 1
|
||||
})
|
||||
onelotteryinfo.ctrl = JSON.stringify(new_ctrl);
|
||||
if (!(new RegExp(uids[1])).test(self.attentionList)) onelotteryinfo.uid.push(uids[1]);
|
||||
ctrl.map(item => {
|
||||
item.location += addlength;
|
||||
return item;
|
||||
}).forEach(it => new_ctrl.push(it))
|
||||
if (!(new RegExp(uids[1])).test(self.attentionList))
|
||||
onelotteryinfo.uid.push(uids[1]);
|
||||
} else {
|
||||
onelotteryinfo.relay_chat = RandomStr;
|
||||
onelotteryinfo.ctrl = '[]'
|
||||
}
|
||||
onelotteryinfo.ctrl = JSON.stringify(new_ctrl);
|
||||
}
|
||||
/* 根据动态的类型决定评论的类型 */
|
||||
onelotteryinfo.type = type === 2 ?
|
||||
@ -173,9 +193,9 @@ class Monitor extends Public {
|
||||
if (times > 0) console.log('等一会儿再发送评论');
|
||||
times++;
|
||||
status = await send();
|
||||
if(status === 0) await Base.delay(5000 * 2 ** (times - 1))
|
||||
if (status === 0) await Base.delay(5000 * 2 ** (times - 1))
|
||||
} while (status === 0 && times < 9);
|
||||
if(status === 0) return status;
|
||||
if (status === 0) return status;
|
||||
}
|
||||
if (!this.isAttentionErr) {
|
||||
uid.forEach(async (one_uid) => {
|
||||
|
||||
@ -110,6 +110,7 @@ async function isMe() {
|
||||
let MySession = await BiliAPI.getSessionInfo();
|
||||
let desp = '';
|
||||
if (MyAtInfo.length) {
|
||||
console.log('正在检查at');
|
||||
MyAtInfo.forEach(async AtInfo => {
|
||||
const { at_time, up_uname, business, source_content, url } = AtInfo
|
||||
if ((Date.now() / 1000 - at_time) / 3600 >= 2) {
|
||||
@ -124,6 +125,7 @@ async function isMe() {
|
||||
});
|
||||
}
|
||||
if (MySession.data.length) {
|
||||
console.log('正在检查私信')
|
||||
let session_t = '';
|
||||
let max = 0;
|
||||
do {
|
||||
@ -133,7 +135,7 @@ async function isMe() {
|
||||
if ((Date.now() / 1000 - timestamp) / 3600 >= 2) {
|
||||
return;
|
||||
}
|
||||
if (/中?奖|地址|支付宝|账号|收款码/.test(content)) {
|
||||
if (/中奖|填写|地址|支付宝|账号|码/.test(content)) {
|
||||
desp += `发生时间: ${transformTimeZone(timestamp * 1000, 8)} <br><br>`
|
||||
desp += `用户: ${sender_uid} <br><br>`
|
||||
desp += `私信你(${GlobalVar.myUID})说: ${content} <br><br>`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user