Compare commits

...
19 Commits
Author SHA1 Message Date
shanmite 92fab1774d docs: 更新CHANGELOG 2023-12-01 10:22:40 +08:00
shanmite addb9c65fe fix: ghproxy.com->mirror.ghproxy.com (#333)
Fixed #333
2023-12-01 10:21:08 +08:00
shanmite b86e756520 fix: at错位 2023-12-01 10:16:11 +08:00
shanmite f3af8dff17 docs: 更新CHANGELOG 2023-11-25 13:46:42 +08:00
shanmite 5d30178bd3 ci: docker构建 2023-11-25 11:21:31 +08:00
shanmite 0c610701cb fix: 评论并转发 (#259)
Fixed #259
2023-11-25 10:42:17 +08:00
shanmite 6dfee7efb8 fix: 出现帐号未登录错误时自动跳转下一个帐号 2023-11-25 10:20:13 +08:00
shanmite 13e847825b docs: 更新CHANGELOG 2023-09-22 09:57:36 +08:00
shanmite 6496a8f0bc fix: fs.close 2023-09-22 09:55:07 +08:00
shanmite 198a69011c docs: 更新CHANGELOG 2023-09-22 07:54:05 +08:00
shanmite e32c3c9e8b fix: 已经关注用户未转发 2023-09-22 07:51:35 +08:00
shanmite 3bd77b3114 fix: fs.close 2023-09-22 07:38:40 +08:00
shanmite 6adc42ae23 docs: 更新CHANGELOG 2023-09-09 16:45:07 +08:00
shanmite 588feba10b docs: update readme 2023-09-09 16:44:17 +08:00
shanmite 5d5858f82b fix: 无法已读未关注未读私信 2023-09-09 16:30:58 +08:00
andywang425andshanmite 1526519e86 docs: 添加gotify推送说明 2023-09-03 17:56:08 +08:00
andywang425andshanmite 69c297ecaa feat: 添加Gotify推送 2023-09-02 18:26:18 +08:00
andywang425andshanmite 201770573e feat: autoAttention API增加对重复关注的处理 2023-09-02 18:26:18 +08:00
shanmite 16c113fd87 docs: update readme 2023-09-01 14:46:59 +08:00
12 changed files with 148 additions and 40 deletions
+1 -1
View File
@@ -31,4 +31,4 @@ jobs:
with:
push: true
tags: ${{ secrets.DOCKERHUB_REPO }}
platforms: "linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x"
platforms: "linux/amd64,linux/arm64"
+34
View File
@@ -1,5 +1,39 @@
<!-- markdownlint-disable MD036 MD024-->
# CHANGELOG
## 主要变化(2.8.13)
* addb9c6 fix: ghproxy.com->mirror.ghproxy.com (#333)
* b86e756 fix: at错位
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.8.12)
* 5d30178 ci: docker构建
* 0c61070 fix: 评论并转发 (#259)
* 6dfee7e fix: 出现帐号未登录错误时自动跳转下一个帐号
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(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: 专栏无法获取
+3 -1
View File
@@ -137,7 +137,7 @@ buvid3亦可不填 使用随机生成值
```
1. 运行截图
![lottery_start](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/lottery_start.png)
![lottery_start](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/lottery_start.png)
#### 以源码方式运行
@@ -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 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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) {
+18 -3
View File
@@ -56,6 +56,9 @@ class Monitor extends Searcher {
case 1001:
event_bus.emit('Turn_off_the_Monitor', '评论失败')
break;
case 1010:
event_bus.emit('Turn_off_the_Monitor', '已掉号')
break;
case 1004:
event_bus.emit('Turn_off_the_Monitor', '需要输入验证码')
break
@@ -194,7 +197,6 @@ class Monitor extends Searcher {
case 1007:
case 1008:
case 1009:
case 1010:
case 1011:
case 2002:
case 2003:
@@ -217,6 +219,7 @@ class Monitor extends Searcher {
is_outof_maxfollow = 2005
break;
case 1001:
case 1010:
case 1004:
case 2001:
case 3001:
@@ -593,6 +596,10 @@ class Monitor extends Searcher {
.replace(
new RegExp(copy_chat[0], 'g'),
global_var.get("myUNAME") || '')
} else {
if (is_repost_then_chat) {
chat = chat + relay_chat
}
}
status = await retryfn(
@@ -600,7 +607,7 @@ class Monitor extends Searcher {
[4],
() => bili.sendChatWithOcr(
rid,
is_repost_then_chat ? relay_chat.split('//')[0] : chat,
chat,
chat_type
)
)
@@ -624,6 +631,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
@@ -664,7 +675,11 @@ class Monitor extends Searcher {
status = await retryfn(
5,
[3, 4],
() => bili.autoRelay(global_var.get("myUID"), dyid, relay_chat, ctrl)
() => bili.autoRelay(
global_var.get("myUID"),
dyid,
relay_chat,
ctrl)
)
if (status) {
+53 -2
View File
@@ -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
View File
@@ -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
+1 -1
View File
@@ -68,7 +68,7 @@ async function update(isDdownload) {
if (download_url.length) {
if (isDdownload) {
await try_for_each(download_url.entries(), async ([i, url]) => {
let proxy_url = "https://ghproxy.com/";
let proxy_url = "https://mirror.ghproxy.com/";
proxy_url += url
log.warn('自动下载', `切换代理${proxy_url}`)
await download(proxy_url, `latest_version${i}.zip`)
+3 -1
View File
@@ -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
View File
@@ -1,6 +1,6 @@
{
"name": "lottery-auto-script",
"version": "2.8.8",
"version": "2.8.13",
"description": "自动参与B站动态抽奖",
"main": "main.js",
"scripts": {