Skip to content

Commit

Permalink
lint: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
shanmiteko committed Jun 21, 2024
1 parent e723136 commit 6c75d57
Show file tree
Hide file tree
Showing 31 changed files with 1,018 additions and 1,008 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@
"ecmaVersion": "latest"
},
"rules": {
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
}
76 changes: 38 additions & 38 deletions env.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ module.exports = Object.freeze({
* **按顺序依次执行, 防止访问频繁封禁IP**
*/
account_parm: {
COOKIE: "",
NOTE: "",
COOKIE: '',
NOTE: '',
NUMBER: 1,
CLEAR: true,
ACCOUNT_UA: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
ACCOUNT_UA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',

ENABLE_CHAT_CAPTCHA_OCR: false,
CHAT_CAPTCHA_OCR_URL: "http://127.0.0.1:9898/ocr/url/text",
CHAT_CAPTCHA_OCR_URL: 'http://127.0.0.1:9898/ocr/url/text',
ENABLE_MULTIPLE_ACCOUNT: false,

MULTIPLE_ACCOUNT_PARM: "",
MULTIPLE_ACCOUNT_PARM: '',
LOTTERY_LOG_LEVEL: 3,
NOT_GO_LOTTERY: ""
NOT_GO_LOTTERY: ''
},

/**
Expand All @@ -59,46 +59,46 @@ module.exports = Object.freeze({
*/
multiple_account_parm: [
{
COOKIE: "",
NOTE: "",
COOKIE: '',
NOTE: '',
NUMBER: 1,
CLEAR: true,
WAIT: 60 * 1000,
ACCOUNT_UA: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
ACCOUNT_UA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
}
],

/**
* 推送相关参数
*/
push_parm: {
SCKEY: "",
SENDKEY: "",
QQ_SKEY: "",
QQ_MODE: "",
BARK_PUSH: "",
BARK_SOUND: "",
PUSHDEER_URL: "",
PUSHDEER_PUSHKEY: "",
TG_BOT_TOKEN: "",
TG_USER_ID: "",
TG_PROXY_HOST: "",
TG_PROXY_PORT: "",
DD_BOT_TOKEN: "",
DD_BOT_SECRET: "",
QYWX_AM: "",
QYWX_KEY: "",
IGOT_PUSH_KEY: "",
PUSH_PLUS_TOKEN: "",
PUSH_PLUS_USER: "",
QMSG_KEY: "",
QMSG_QQ: "",
SMTP_HOST: "",
SMTP_PORT: "",
SMTP_USER: "",
SMTP_PASS: "",
SMTP_TO_USER: "",
GOTIFY_URL: "",
GOTIFY_APPKEY: ""
SCKEY: '',
SENDKEY: '',
QQ_SKEY: '',
QQ_MODE: '',
BARK_PUSH: '',
BARK_SOUND: '',
PUSHDEER_URL: '',
PUSHDEER_PUSHKEY: '',
TG_BOT_TOKEN: '',
TG_USER_ID: '',
TG_PROXY_HOST: '',
TG_PROXY_PORT: '',
DD_BOT_TOKEN: '',
DD_BOT_SECRET: '',
QYWX_AM: '',
QYWX_KEY: '',
IGOT_PUSH_KEY: '',
PUSH_PLUS_TOKEN: '',
PUSH_PLUS_USER: '',
QMSG_KEY: '',
QMSG_QQ: '',
SMTP_HOST: '',
SMTP_PORT: '',
SMTP_USER: '',
SMTP_PASS: '',
SMTP_TO_USER: '',
GOTIFY_URL: '',
GOTIFY_APPKEY: ''
}
})
});
12 changes: 6 additions & 6 deletions lib/account.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const bili = require('./net/bili')
const { log } = require('./utils')
const bili = require('./net/bili');
const { log } = require('./utils');

async function account() {
const my_info = await bili.getMyinfo();
const stat = await bili.getStat();
if (my_info && stat) {
log.info("帐号信息", `${my_info.name} Lv${my_info.level} ${my_info.silence ? "已封禁" : "未封禁"} 升级还需${my_info.level_exp.next_exp - my_info.level_exp.current_exp}经验`)
log.info("帐号信息", `当前关注数:${stat.following} 粉丝数:${stat.follower} 动态数量:${stat.dynamic_count}`)
log.info('帐号信息', `${my_info.name} Lv${my_info.level} ${my_info.silence ? '已封禁' : '未封禁'} 升级还需${my_info.level_exp.next_exp - my_info.level_exp.current_exp}经验`);
log.info('帐号信息', `当前关注数:${stat.following} 粉丝数:${stat.follower} 动态数量:${stat.dynamic_count}`);
} else {
log.error("帐号信息", "获取失败");
log.error('帐号信息', '获取失败');
}
}

module.exports = { account }
module.exports = { account };
74 changes: 37 additions & 37 deletions lib/check.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { log, delay, infiniteNumber, judge } = require('./utils')
const { sendNotify } = require('./helper/notify')
const config = require('./data/config')
const global_var = require('./data/global_var')
const bili = require('./net/bili')
const { log, delay, infiniteNumber, judge } = require('./utils');
const { sendNotify } = require('./helper/notify');
const config = require('./data/config');
const global_var = require('./data/global_var');
const bili = require('./net/bili');

/**
* 是否中奖
Expand All @@ -21,14 +21,14 @@ async function isMe(num) {
MyAtInfo
.slice(0, unread_at_num)
.forEach(({ at_time, up_uname, business, source_content, url }) => {
desp += '## [at]检测结果\n\n'
desp += '- - - -\n\n'
desp += `发生时间: ${new Date(at_time * 1000).toLocaleString()}\n\n`
desp += `用户: ${up_uname}\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'
desp += '## [at]检测结果\n\n';
desp += '- - - -\n\n';
desp += `发生时间: ${new Date(at_time * 1000).toLocaleString()}\n\n`;
desp += `用户: ${up_uname}\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';
});
log.info('中奖检测', '--> OK');
}
Expand All @@ -39,63 +39,63 @@ async function isMe(num) {
.slice(0, unread_reply_num)
.forEach(({ nickname, uri, source, timestamp }) => {
if (judge(source, notice_key_words)) {
desp += '## 回复检测结果\n\n'
desp += '- - - -\n\n'
desp += `发生时间: ${new Date(timestamp * 1000).toLocaleString()}\n\n`
desp += `用户: ${nickname}\n\n`
desp += `回复[你](https://space.bilibili.com/${global_var.get("myUID")})说:\n${source}\n\n`
desp += `[直达链接](${uri})\n\n`
desp += '- - - -\n\n'
desp += '## 回复检测结果\n\n';
desp += '- - - -\n\n';
desp += `发生时间: ${new Date(timestamp * 1000).toLocaleString()}\n\n`;
desp += `用户: ${nickname}\n\n`;
desp += `回复[你](https://space.bilibili.com/${global_var.get('myUID')})说:\n${source}\n\n`;
desp += `[直达链接](${uri})\n\n`;
desp += '- - - -\n\n';
}
})
});
log.info('中奖检测', '--> OK');
}
if (follow_unread + unfollow_unread > 0) {
const check = async (type) => {
let session_t = '';
let MySession = await bili.getSessionInfo(type)
log.info("准备检查私信", check_session_pages + "页")
let MySession = await bili.getSessionInfo(type);
log.info('准备检查私信', check_session_pages + '页');
for (const index of infiniteNumber()) {
for (const Session of MySession.data) {
const { sender_uid, session_ts, timestamp, unread_count, talker_id, msg_seqno } = Session;
session_t = session_ts;
if (unread_count) {
const content = await bili.fetch_session_msgs(talker_id, unread_count);
if (judge(content, notice_key_words)) {
desp += '## 私信检测结果\n\n'
desp += '- - - -\n\n'
desp += `发生时间: ${new Date(timestamp * 1000).toLocaleString()}\n\n`
desp += `用户: ${sender_uid}\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'
desp += '## 私信检测结果\n\n';
desp += '- - - -\n\n';
desp += `发生时间: ${new Date(timestamp * 1000).toLocaleString()}\n\n`;
desp += `用户: ${sender_uid}\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';
}
await bili.updateSessionStatus(talker_id, type, msg_seqno);
await delay(update_session_wait);
}
}
if (MySession.has_more && index < check_session_pages) {
await delay(get_session_wait);
MySession = await bili.getSessionInfo(type, session_t)
MySession = await bili.getSessionInfo(type, session_t);
} else {
break
break;
}
}
}
};
if (follow_unread) {
log.info('中奖检测', '<-- 正在检查已关注者的私信')
log.info('中奖检测', '<-- 正在检查已关注者的私信');
}
if (unfollow_unread) {
log.info('中奖检测', '<-- 正在检查未关注者的私信')
log.info('中奖检测', '<-- 正在检查未关注者的私信');
}
await check("1")
await check('1');
log.info('中奖检测', '--> OK');
}
if (desp) {
log.info('可能中奖了', desp);
await sendNotify(`帐号${num}可能中奖了`, desp);
} else {
log.info('中奖检测', "暂未中奖");
log.info('中奖检测', '暂未中奖');
}
return;
}
Expand Down
Loading

0 comments on commit 6c75d57

Please sign in to comment.