mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13e847825b | ||
|
|
6496a8f0bc | ||
|
|
198a69011c | ||
|
|
e32c3c9e8b | ||
|
|
3bd77b3114 | ||
|
|
6adc42ae23 | ||
|
|
588feba10b | ||
|
|
5d5858f82b | ||
|
|
1526519e86 | ||
|
|
69c297ecaa | ||
|
|
201770573e | ||
|
|
16c113fd87 |
@@ -1,5 +1,26 @@
|
||||
<!-- markdownlint-disable MD036 MD024-->
|
||||
# CHANGELOG
|
||||
## 主要变化(2.8.11)
|
||||
* 6496a8f fix: fs.close
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.10)
|
||||
* e32c3c9 fix: 已经关注用户未转发
|
||||
* 3bd77b3 fix: fs.close
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.9)
|
||||
* 588feba docs: update readme
|
||||
* 5d5858f fix: 无法已读未关注未读私信
|
||||
* 1526519 docs: 添加gotify推送说明
|
||||
* 69c297e feat: 添加Gotify推送
|
||||
* 2017705 feat: autoAttention API增加对重复关注的处理
|
||||
* 16c113f docs: update readme
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.8)
|
||||
* 54af844 fix: 专栏无法获取
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ buvid3亦可不填 使用随机生成值
|
||||
```
|
||||
|
||||
1. 运行截图
|
||||

|
||||

|
||||
|
||||
#### 以源码方式运行
|
||||
|
||||
@@ -203,6 +203,8 @@ buvid3亦可不填 使用随机生成值
|
||||
| `SMTP_USER` | 电子邮件 | 发送方的电子邮件 如: `xxxxxxxxx@qq.com` |
|
||||
| `SMTP_PASS` | 电子邮件 | smtp服务对应的授权码 |
|
||||
| `SMTP_TO_USER` | 电子邮件 | 接收方电子邮件 |
|
||||
| `GOTIFY_URL` | gotify推送 | gotify消息推送地址(例如 http://localhost:8008/message),[官方文档](https://gotify.net/docs/) |
|
||||
| `GOTIFY_APPKEY` | gotify推送 | 一个gotify application的token,[官方文档](https://gotify.net/docs/) |
|
||||
|
||||
----------------------------------------
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
1.初始化
|
||||
|
||||
```bash
|
||||
curl -fsSL https://cdn.staticaly.com/gh/shanmiteko/LotteryAutoScript/main/script/docker/init.sh | sudo sh
|
||||
curl -fsSL https://ghproxy.com/https://raw.githubusercontent.com/shanmiteko/LotteryAutoScript/main/script/docker/init.sh | sudo bash
|
||||
```
|
||||
|
||||
进入`lottery`文件夹
|
||||
|
||||
+7
-5
@@ -12,12 +12,12 @@ module.exports = Object.freeze({
|
||||
* ## 调试相关
|
||||
* - `LOTTERY_LOG_LEVEL` 输出日志等级 Error<Warn<Info<Debug 1<2<3<4
|
||||
* - `NOT_GO_LOTTERY` 关闭抽奖行为
|
||||
*
|
||||
*
|
||||
* ## 多账号
|
||||
* 1. 将 ENABLE_MULTIPLE_ACCOUNT 的值改为true
|
||||
* 2. 将账号信息依次填写于 multiple_account_parm 中, 参考例子类推
|
||||
* - `WAIT` 表示下一个账号运行等待时间(毫秒)
|
||||
*
|
||||
*
|
||||
* **按顺序依次执行, 防止访问频繁封禁IP**
|
||||
*/
|
||||
account_parm: {
|
||||
@@ -37,7 +37,7 @@ module.exports = Object.freeze({
|
||||
/**
|
||||
* 为防止环境变量过长, 请将多账号填在此处
|
||||
* 以 **大括号内容** 为模板依次复制(包含大括号),逗号分割
|
||||
*
|
||||
*
|
||||
* ```txt
|
||||
* [
|
||||
* {
|
||||
@@ -92,6 +92,8 @@ module.exports = Object.freeze({
|
||||
SMTP_PORT: "",
|
||||
SMTP_USER: "",
|
||||
SMTP_PASS: "",
|
||||
SMTP_TO_USER: ""
|
||||
SMTP_TO_USER: "",
|
||||
GOTIFY_URL: "",
|
||||
GOTIFY_APPKEY: ""
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
+1
-2
@@ -84,12 +84,11 @@ async function isMe(num) {
|
||||
}
|
||||
if (follow_unread) {
|
||||
log.info('中奖检测', '<-- 正在检查已关注者的私信')
|
||||
await check(1)
|
||||
}
|
||||
if (unfollow_unread) {
|
||||
log.info('中奖检测', '<-- 正在检查未关注者的私信')
|
||||
await check(2)
|
||||
}
|
||||
await check("1")
|
||||
log.info('中奖检测', '--> OK');
|
||||
}
|
||||
if (desp) {
|
||||
|
||||
@@ -624,6 +624,10 @@ class Monitor extends Searcher {
|
||||
if (uid.length) {
|
||||
await try_for_each(uid, async (u) => {
|
||||
status = await bili.autoAttention(u)
|
||||
if (status === 6) {
|
||||
status = 0;
|
||||
return false
|
||||
}
|
||||
if (status) {
|
||||
log.warn("抽奖信息", `dyid: ${dyid}, uid: ${u}`)
|
||||
return true
|
||||
|
||||
+53
-2
@@ -80,6 +80,13 @@ let SMTP_USER = '';
|
||||
let SMTP_PASS = '';
|
||||
let SMTP_TO_USER = '';
|
||||
|
||||
// ====================================Gotify======================================
|
||||
// 官方文档:https://gotify.net/docs/pushmsg
|
||||
// 此处填你的Gotify消息推送地址(例如:http://localhost/message)
|
||||
let GOTIFY_URL = '';
|
||||
// 此处填你想推送的Application的Token(不包含推送时额外添加的前缀 Bearer )
|
||||
let GOTIFY_APPKEY = '';
|
||||
|
||||
//==========================云端环境变量的判断与接收=========================
|
||||
if (process.env.SCKEY) {
|
||||
SCKEY = process.env.SCKEY;
|
||||
@@ -190,6 +197,13 @@ if (process.env.SMTP_TO_USER) {
|
||||
SMTP_TO_USER = process.env.SMTP_TO_USER;
|
||||
}
|
||||
|
||||
if (process.env.GOTIFY_URL) {
|
||||
GOTIFY_URL = process.env.GOTIFY_URL;
|
||||
if (process.env.GOTIFY_APPKEY) {
|
||||
GOTIFY_APPKEY = process.env.GOTIFY_APPKEY
|
||||
}
|
||||
}
|
||||
|
||||
//==========================云端环境变量的判断与接收=========================
|
||||
|
||||
async function sendNotify(text, desp, params = {}) {
|
||||
@@ -223,7 +237,9 @@ async function sendNotify(text, desp, params = {}) {
|
||||
// Qmsg
|
||||
qmsg(text, desp),
|
||||
//电子邮件
|
||||
email(text, desp)
|
||||
email(text, desp),
|
||||
// Gotify
|
||||
gotifyNotify(text, desp)
|
||||
])
|
||||
}
|
||||
|
||||
@@ -820,6 +836,41 @@ function pushPlusNotify(text, desp) {
|
||||
})
|
||||
}
|
||||
|
||||
function gotifyNotify(text, desp) {
|
||||
return new Promise(resolve => {
|
||||
if (GOTIFY_APPKEY) {
|
||||
send({
|
||||
method: 'POST',
|
||||
url: GOTIFY_URL,
|
||||
contents: {
|
||||
title: text,
|
||||
message: desp,
|
||||
},
|
||||
config: {
|
||||
retry: false
|
||||
},
|
||||
headers: {
|
||||
accept: 'application/json, text/plain, */*',
|
||||
'content-type': 'application/json',
|
||||
'authorization': 'Bearer ' + GOTIFY_APPKEY
|
||||
},
|
||||
success: () => {
|
||||
// HTTP 响应码 200 就说明成功了
|
||||
log.info('发送通知', 'Gotify 发送通知消息成功')
|
||||
resolve();
|
||||
},
|
||||
failure: err => {
|
||||
log.error('发送通知', 'Gotify 发送通知调用API失败!!' + err)
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
log.debug('发送通知', '您未提供Gotify推送所需的GOTIFY_APPKEY,取消Gotify推送消息通知');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function qmsg(text, desp) {
|
||||
return new Promise(resolve => {
|
||||
if (QMSG_KEY) {
|
||||
@@ -889,4 +940,4 @@ async function email(text, desp) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { sendNotify }
|
||||
module.exports = { sendNotify }
|
||||
|
||||
+25
-22
@@ -259,11 +259,11 @@ const bili_client = {
|
||||
* @property {number} sender_uid
|
||||
* @property {number} talker_id
|
||||
* @property {number} msg_seqno
|
||||
*
|
||||
*
|
||||
* @typedef SessionInfo
|
||||
* @property {number} has_more
|
||||
* @property {SessionData[]} data
|
||||
*
|
||||
*
|
||||
* @param {number} session_type 1 已关注 2 未关注 3 应援团
|
||||
* @param {string} [ts_16]
|
||||
* @returns {Promise<SessionInfo>}
|
||||
@@ -397,7 +397,7 @@ const bili_client = {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @param {string} short_id
|
||||
* @param {string} short_id
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async shortDynamicIdToDyid(short_id) {
|
||||
@@ -737,6 +737,8 @@ const bili_client = {
|
||||
return [false, 4, '账号异常']
|
||||
case 22009:
|
||||
return [false, 5, '关注已达上限']
|
||||
case 22014:
|
||||
return [false, 6, '已经关注用户,无法重复关注']
|
||||
default:
|
||||
return [true, 1, `未知错误\n${responseText}`]
|
||||
}
|
||||
@@ -748,12 +750,13 @@ const bili_client = {
|
||||
* @param {Number} uid
|
||||
* 被关注者的UID
|
||||
* @returns {Promise<number>}
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 您已被对方拉入黑名单 2
|
||||
* - 黑名单用户无法关注 3
|
||||
* - 账号异常 4
|
||||
* - 关注已达上限 5
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 您已被对方拉入黑名单 2
|
||||
* - 黑名单用户无法关注 3
|
||||
* - 账号异常 4
|
||||
* - 关注已达上限 5
|
||||
* - 已经关注用户 6
|
||||
*/
|
||||
autoAttention(uid) {
|
||||
return this._autoAttention.run(uid)
|
||||
@@ -763,8 +766,8 @@ const bili_client = {
|
||||
* @param {number} uid
|
||||
* @param {number} tagid 关注分区的ID
|
||||
* @returns {Promise<number>}
|
||||
* - 成功 0
|
||||
* - 失败 1
|
||||
* - 成功 0
|
||||
* - 失败 1
|
||||
*/
|
||||
async movePartition(uid, tagid) {
|
||||
const responseText = await post({
|
||||
@@ -816,7 +819,7 @@ const bili_client = {
|
||||
* 动态自动点赞
|
||||
* @param {string} dyid
|
||||
* @returns {Promise<number>}
|
||||
* - 成功 0
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 点赞异常 2
|
||||
* - 点赞频繁 3
|
||||
@@ -865,11 +868,11 @@ const bili_client = {
|
||||
* @param {string} [msg]
|
||||
* 动态的ID
|
||||
* @returns {Promise<number>}
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 该动态不能转发分享 2
|
||||
* - 请求数据发生错误,请刷新或稍后重试 3
|
||||
* - 操作太频繁了,请稍后重试 4
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 该动态不能转发分享 2
|
||||
* - 请求数据发生错误,请刷新或稍后重试 3
|
||||
* - 操作太频繁了,请稍后重试 4
|
||||
*/
|
||||
async autoRelay(uid, dyid, msg = '转发动态', ctrl = '[]') {
|
||||
const len = msg.length;
|
||||
@@ -912,7 +915,7 @@ const bili_client = {
|
||||
/**
|
||||
* 预约抽奖
|
||||
* @param {string} reserve_id
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
async reserve_lottery(reserve_id) {
|
||||
const
|
||||
@@ -1238,9 +1241,9 @@ const bili_client = {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 检查分区
|
||||
* 不存在指定分区时创建
|
||||
* 获取到tagid添加为对象的属性
|
||||
* 检查分区
|
||||
* 不存在指定分区时创建
|
||||
* 获取到tagid添加为对象的属性
|
||||
* @param {string} [name]
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
@@ -1332,4 +1335,4 @@ const bili_client = {
|
||||
};
|
||||
|
||||
|
||||
module.exports = bili_client
|
||||
module.exports = bili_client
|
||||
|
||||
+3
-1
@@ -44,7 +44,8 @@ const utils = {
|
||||
try {
|
||||
const obj = JSON.parse(str);
|
||||
return typeof obj === 'object' ? obj : false
|
||||
} catch (_) {
|
||||
} catch (e) {
|
||||
utils.log.error("json解析", e)
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -383,6 +384,7 @@ const utils = {
|
||||
rejects(err)
|
||||
} else {
|
||||
fs.write(fd, buffer, 0, buffer.length, 0, err => {
|
||||
fs.close(fd)
|
||||
if (err) {
|
||||
rejects(err)
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lottery-auto-script",
|
||||
"version": "2.8.8",
|
||||
"version": "2.8.11",
|
||||
"description": "自动参与B站动态抽奖",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user