mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
fix: 修复无法清理动态
This commit is contained in:
parent
96c578a39c
commit
62918abf85
@ -1,3 +1,5 @@
|
||||
const { tooltip } = require('./Base');
|
||||
|
||||
const default_script = {
|
||||
version: '|version: 3.8.2|in nodejs',
|
||||
author: '@shanmite',
|
||||
@ -28,7 +30,7 @@ const my_config = (() => {
|
||||
if (UIDs) _my_config.UIDs = UIDs;
|
||||
if (TAGs) _my_config.TAGs = TAGs;
|
||||
} catch (_) {
|
||||
console.log("无自定义设置");
|
||||
tooltip.log("[script]无自定义设置");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@ -36,7 +38,7 @@ const my_config = (() => {
|
||||
if (UIDs) _my_config.UIDs = UIDs;
|
||||
if (TAGs) _my_config.TAGs = TAGs;
|
||||
} catch (_) {
|
||||
console.log("MY_CONFIG语法错误");
|
||||
tooltip.log("[script]MY_CONFIG语法错误");
|
||||
}
|
||||
}
|
||||
return _my_config;
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
const { tooltip } = require('./Base');
|
||||
|
||||
/**
|
||||
* 默认设置
|
||||
* 如需修改请按照readme文件要求填写在指定位置
|
||||
@ -37,13 +39,13 @@ const my_config = (() => {
|
||||
try {
|
||||
_my_config = require('../my_config.json')
|
||||
} catch (_) {
|
||||
console.log("无自定义设置");
|
||||
tooltip.log("[config]无自定义设置");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
_my_config = JSON.parse(process.env.MY_CONFIG);
|
||||
} catch (_) {
|
||||
console.log("MY_CONFIG语法错误");
|
||||
tooltip.log("[config]MY_CONFIG语法错误");
|
||||
}
|
||||
}
|
||||
return _my_config;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
const Base = require('./Base');
|
||||
const { transformTimeZone } = require('./Base');
|
||||
const BiliAPI = require('./BiliAPI');
|
||||
const GihubAPI = require("./GithubAPI");
|
||||
const eventBus = require('./eventBus');
|
||||
@ -91,7 +90,7 @@ async function isMe() {
|
||||
const MyAtInfo = await BiliAPI.getMyAtInfo();
|
||||
MyAtInfo.forEach(async AtInfo => {
|
||||
const { at_time, up_uname, business, source_content, url } = AtInfo
|
||||
desp += `发生时间: ${transformTimeZone(at_time * 1000, 8)} \n\n`
|
||||
desp += `发生时间: ${Base.transformTimeZone(at_time * 1000, 8)} \n\n`
|
||||
desp += `用户: ${up_uname} \n\n`
|
||||
desp += `在${business}中@了你(${GlobalVar.myUID}) \n\n`
|
||||
desp += `原内容为: ${source_content} \n\n`
|
||||
@ -113,7 +112,7 @@ async function isMe() {
|
||||
BiliAPI.updateSessionStatus(talker_id);
|
||||
await Base.delay(1000);
|
||||
if (/中奖|获得|填写|写上|提供|地址|支付宝账号|码|大会员/.test(content)) {
|
||||
desp += `发生时间: ${transformTimeZone(timestamp * 1000, 8)} \n\n`
|
||||
desp += `发生时间: ${Base.transformTimeZone(timestamp * 1000, 8)} \n\n`
|
||||
desp += `用户: ${sender_uid} \n\n`
|
||||
desp += `私信你(${GlobalVar.myUID})说: ${content} \n\n`
|
||||
desp += `[直达链接](https://message.bilibili.com/#/whisper/mid${sender_uid}) \n\n`
|
||||
|
||||
52
main.js
52
main.js
@ -6,34 +6,38 @@ try {
|
||||
tooltip.log("无env.js文件");
|
||||
}
|
||||
|
||||
const { setVariable } = require("./lib/setVariable");
|
||||
const { start, isMe, checkCookie } = require("./lib/lottery-in-nodejs");
|
||||
const { clear } = require("./lib/clear");
|
||||
|
||||
((async () => {
|
||||
const { NUMBER, CLEAR, COOKIE, PAT, LOCALLAUNCH } = process.env;
|
||||
if (COOKIE) {
|
||||
if (!LOCALLAUNCH && !PAT) { tooltip.log('请查看README文件, 填入相应的PAT'); return; }
|
||||
const { setVariable } = require("./lib/setVariable");
|
||||
if (!LOCALLAUNCH && !PAT) {
|
||||
tooltip.log('请查看README文件, 填入相应的PAT');
|
||||
return;
|
||||
}
|
||||
await setVariable(COOKIE);
|
||||
const { start, isMe, checkCookie } = require("./lib/lottery-in-nodejs");
|
||||
const { clear } = require("./lib/clear");
|
||||
const isRight = await checkCookie(NUMBER);
|
||||
if (!isRight) return;
|
||||
switch (process.argv.slice(2)[0]) {
|
||||
case 'start':
|
||||
tooltip.log('开始参与抽奖');
|
||||
await start();
|
||||
break;
|
||||
case 'check':
|
||||
tooltip.log('检查是否中奖');
|
||||
await isMe();
|
||||
break;
|
||||
case 'clear':
|
||||
if (CLEAR === 'true') {
|
||||
tooltip.log('开始清理动态');
|
||||
await clear();
|
||||
tooltip.log('清理动态完毕');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (await checkCookie(NUMBER)) {
|
||||
switch (process.argv.slice(2)[0]) {
|
||||
case 'start':
|
||||
tooltip.log('开始参与抽奖');
|
||||
await start();
|
||||
break;
|
||||
case 'check':
|
||||
tooltip.log('检查是否中奖');
|
||||
await isMe();
|
||||
break;
|
||||
case 'clear':
|
||||
if (CLEAR) {
|
||||
tooltip.log('开始清理动态');
|
||||
await clear();
|
||||
tooltip.log('清理动态完毕');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
process.exit(0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user