Compare commits

..
37 Commits
Author SHA1 Message Date
shanmite 003508e1f3 docs: 更新CHANGELOG 2022-11-07 15:19:35 +08:00
shanmite 847e6806c6 feat: 丰富推送内容(#135)(#194)(#211)
Fixed #135
Fixed #194
Fixed #211
2022-11-07 15:14:10 +08:00
shanmite 8bf5070459 fix: flatMap is not a function (#218)
Fixed #218
2022-11-07 13:33:07 +08:00
shanmite 727883a269 feat: 推送NOTE (#221)
Fixed #221
2022-11-07 13:18:46 +08:00
shanmite fd33478af1 fix: 微信企业应用推送未配置出错 (#220)
Fixed #220
2022-11-07 12:34:23 +08:00
shanmite b2d9e192aa docs: 更新CHANGELOG 2022-11-05 12:39:14 +08:00
shanmite db7ba49ca1 style: 修改通知格式 2022-11-05 12:30:16 +08:00
shanmite b51882819a feat: 新增企业微信应用推送 (#217)
Fixed #217
2022-11-05 12:20:01 +08:00
shanmite e0a8ce5b20 doc: update image 2022-10-31 12:49:27 +08:00
shanmite 2b2613386d docs: 更新CHANGELOG 2022-10-31 12:39:14 +08:00
shanmite 92f700384e perf: monochrome 2022-10-31 12:34:42 +08:00
shanmite 8e77afadc3 fix: fs.uninkSync returns before remove finish 2022-10-31 11:34:16 +08:00
shanmite bfc8fb6a14 ci: gitlab mirror workflow_dispatch 2022-10-30 12:43:01 +08:00
shanmite f8dbe5ea5a docs: 更新CHANGELOG 2022-10-30 11:33:28 +08:00
shanmite 47e09a1263 ci: arm64 added, and optimized 2022-10-30 11:29:25 +08:00
shanmite b91a4f979d fix: fs.rm node12 2022-10-30 09:40:09 +08:00
shanmite d9cecbe163 ci: push shanmite/pkg-arm64 2022-10-29 20:37:09 +08:00
shanmite 989f836ba2 ci: 修改github release镜像源 2022-10-29 20:05:10 +08:00
shanmite 98948ad7f0 docs: 更新CHANGELOG 2022-10-29 13:41:28 +08:00
shanmite a363b4ee34 ci: 关闭arm64自动打包
```
curl: (18) transfer closed with 44597952 bytes remaining to read
Error: error building at STEP "RUN mkdir -p "${PKG_CACHE_PATH}" && curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linux-arm64" -o "${PKG_CACHE_PATH}/fetched-v$NODEV-linux-arm64" && curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linuxstatic-arm64" -o "${PKG_CACHE_PATH}/fetched-v$NODEV-linuxstatic-arm64"": error while running runtime: exit status 18
Error: Process completed with exit code 125.
```
2022-10-29 13:38:38 +08:00
shanmite c220ff5d27 feat(多账号优化): 抽奖信息本地保存 (#209)
Fixed #209
2022-10-29 13:15:36 +08:00
shanmite 2b6cc8d602 feat: 每条运行结果后面加上当前账号序列号 (#206) 2022-10-29 13:15:23 +08:00
ypw96andshanmite 856dd79ee9 fix: 增加获取关注上限(#207) 2022-10-20 19:29:05 +08:00
shanmite 468300227d fix: 青龙执行脚本时出错(#202) 2022-09-24 20:35:29 +08:00
shanmite ae4d1fde91 docs: 更新CHANGELOG 2022-09-24 17:24:47 +08:00
shanmite ca1acd21e8 fix: 转发随机动态视频新的错误码(#201)
Fixed #201
2022-09-24 16:26:44 +08:00
shanmite dabf8f9d75 fix: 关注出错(#199)
Fixed #199
2022-09-24 16:20:43 +08:00
shanmite affe24f441 fix: 发布随机动态显示转发请求不合法(#197)
Fixed #197
2022-09-24 16:15:25 +08:00
shanmite 3a5a8d0ded feat: ql support(#200)
Fixed #200
2022-09-23 13:47:23 +08:00
shanmite 5d3103102e docs: 更新CHANGELOG 2022-09-11 17:58:13 +08:00
shanmite 7ab38f258c feat: 弃用update_loop_wait(#180)
Fixed #180
2022-09-11 17:55:02 +08:00
shanmite 35fe4481fa feat: 预约抽奖参与间隔reserve_lottery_wait(#191)
Fixed #191
2022-09-11 17:42:23 +08:00
shanmite 58edd4129c fix: 该动态不能转发分享(#189)
Fixed #189
2022-09-11 17:24:43 +08:00
shanmite c8e1a328ec fix: 关注UP主7天以上的人可发评论(#192)
Fixed #192
2022-09-11 17:12:50 +08:00
shanmite 4f8f50f90b ci: docker 2022-08-29 10:47:01 +08:00
shanmite 3b4b85bc42 ci: pkg 2022-08-29 09:25:11 +08:00
shanmite db11265b28 docker: sh change to bash 2022-08-29 09:18:07 +08:00
41 changed files with 762 additions and 374 deletions
+1 -1
View File
@@ -31,4 +31,4 @@ jobs:
with:
push: true
tags: ${{ secrets.DOCKERHUB_REPO }}
platforms: "linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/riscv64"
platforms: "linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x"
+17 -13
View File
@@ -1,20 +1,24 @@
name: Mirror and run GitLab CI
on: [push]
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Mirror + trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://gitlab.com/shanmiteko/LotteryAutoScript"
env:
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "gitlab.com"
GITLAB_USERNAME: "shanmiteko"
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "36365601"
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- uses: actions/checkout@v1
- name: Mirror + trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://gitlab.com/shanmiteko/LotteryAutoScript"
env:
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "gitlab.com"
GITLAB_USERNAME: "shanmiteko"
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "36365601"
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+11 -4
View File
@@ -2,6 +2,9 @@ name: "Package Node.js project into an executable"
on:
push:
branches:
- main
- pkg
paths:
- "lib/**"
- "*.js"
@@ -34,7 +37,6 @@ jobs:
node-version: "*"
- name: "Pkg this"
run: |
npm install
npm run pkg "node${{ matrix.nodev }}-${{ matrix.platform }}-x64"
- name: "Upload to artifact"
uses: actions/upload-artifact@v2
@@ -52,14 +54,19 @@ jobs:
overwrite: true
arm64:
runs-on: ubuntu-latest
name: arm64
name: node18-${{ matrix.platform }}-arm64
strategy:
matrix:
include:
- platform: linux
- platform: linuxstatic
- platform: alpine
steps:
- name: "Checkout codes"
uses: actions/checkout@v2
- name: "Pkg this"
run: |
sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
npm run pkg arm
npm run pkg "${{ matrix.platform }}-arm64"
- name: "Upload to artifact"
uses: actions/upload-artifact@v2
with:
+2
View File
@@ -2,9 +2,11 @@ node_modules/
.vscode/
tests/
dyids/
lottery_info/
dist/
.env
*.log
*.zip
package-lock.json
env.js
my_config.js
+58
View File
@@ -1,5 +1,63 @@
<!-- markdownlint-disable MD036 MD024-->
# CHANGELOG
## 主要变化(2.6.8)
* 847e680 feat: 丰富推送内容(#135)(#194)(#211)
* 8bf5070 fix: `flatMap` is not a function (#218)
* 727883a feat: 推送`NOTE` (#221)
* fd33478 fix: 微信企业应用推送未配置出错 (#220)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.6.7)
* db7ba49 style: 修改通知格式
* b518828 feat: 新增企业微信应用推送 (#217)
* e0a8ce5 doc: update image
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.6.6)
* 92f7003 perf: monochrome
* 8e77afa fix: `fs.uninkSync` returns before remove finish
* bfc8fb6 ci: gitlab mirror `workflow_dispatch`
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.6.5)
* 47e09a1 ci: arm64 added, and optimized
* b91a4f9 fix: `fs.rm` node12
* d9cecbe ci: push shanmite/pkg-arm64
* 989f836 ci: 修改github release镜像源
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.6.4)
* a363b4e ci: 关闭`arm64`自动打包
* c220ff5 feat(多账号优化): 抽奖信息本地保存 (#209)
* 2b6cc8d feat: 每条运行结果后面加上当前账号序列号 (#206)
* 856dd79 fix: 增加获取关注上限(#207)
* 4683002 fix: 青龙执行脚本时出错(#202)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.6.3)
* ca1acd2 fix: 转发随机动态视频新的错误码(#201)
* dabf8f9 fix: 关注出错(#199)
* affe24f fix: 发布随机动态显示转发请求不合法(#197)
* 3a5a8d0 feat: 青龙面板(#200)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.6.2)
* 7ab38f2 feat: 弃用`update_loop_wait`(#180)
* 35fe448 feat: 预约抽奖参与间隔`reserve_lottery_wait`(#191)
* 58edd41 fix: 该动态不能转发分享(#189)
* c8e1a32 fix: 关注UP主7天以上的人可发评论(#192)
* 4f8f50f ci: docker
* 3b4b85b ci: pkg
* db11265 docker: change sh to bash
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.6.1)
* 82efbb4 ci: pkg arm64 use podman
* 886ccff fix: cookie缺少`buvid3`导致412(#182)(#185)
+2 -2
View File
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM node:lts-alpine
FROM node:lts-alpine
LABEL author="shanmite" version="1.1" description="自动参与B站动态抽奖"
@@ -12,4 +12,4 @@ COPY ["main.js", "./"]
COPY ["lib/", "lib/"]
ENTRYPOINT ["npm", "run"]
CMD ["start"]
CMD ["start"]
+16 -15
View File
@@ -1,22 +1,23 @@
FROM arm64v8/node
FROM arm64v8/node:lts-alpine
WORKDIR /root/lottery
COPY . .
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk add --no-cache curl
RUN npm config set registry https://registry.npm.taobao.org && npm i
ENV DOWNLOAD_HOST=https://download.fastgit.org \
RELEASE_TAG=v3.4 \
NODEV=18.5.0 \
PKG_CACHE_PATH=/root/.pkg-cache \
PKG_IGNORE_TAG=true
ENV DOWNLOAD_HOST=https://ghproxy.com/https://github.com \
RELEASE_TAG=v3.4 \
NODEV=18.5.0 \
PKG_CACHE_PATH=/root/.pkg-cache \
PKG_IGNORE_TAG=true
RUN mkdir -p "${PKG_CACHE_PATH}" && \
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linux-arm64" -o \
"${PKG_CACHE_PATH}/fetched-v$NODEV-linux-arm64" && \
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linuxstatic-arm64" -o \
"${PKG_CACHE_PATH}/fetched-v$NODEV-linuxstatic-arm64"
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linux-arm64" -o \
"${PKG_CACHE_PATH}/fetched-v$NODEV-linux-arm64" && \
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-alpine-arm64" -o \
"${PKG_CACHE_PATH}/fetched-v$NODEV-alpine-arm64" && \
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linuxstatic-arm64" -o \
"${PKG_CACHE_PATH}/fetched-v$NODEV-linuxstatic-arm64"
CMD ["bash", "-c", "npx pkg -t node$NODEV-linuxstatic-arm64 -o dist/lottery-auto-script-node$NODEV-linuxstatic-arm64 . && \
npx pkg -t node$NODEV-linux-arm64 -o dist/lottery-auto-script-node$NODEV-linux-arm64 ."]
ENTRYPOINT ["npx", "pkg"]
CMD [""]
+52 -153
View File
@@ -6,9 +6,8 @@
- [本地运行](#本地运行)
- [可执行文件](#可执行文件)
- [以源码方式运行](#以源码方式运行)
- [Windows](#windows)
- [Linux](#linux)
- [Docker](#docker)
- [青龙面板](#青龙面板)
- [防重复转发(可选)](#防重复转发可选)
- [检测中奖](#检测中奖)
- [检测未读信息, 已读未读信息](#检测未读信息-已读未读信息)
@@ -64,7 +63,7 @@ Chrome浏览器:
(此步骤是为了方便后续采用JS获取Cookies,获取完毕后应再次勾选)
![取消httponly](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/getCookies.png)
![取消httponly](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/getCookies.png)
3. 在Console中复制以下代码回车
@@ -109,143 +108,40 @@ Chrome浏览器:
3. 在`env.js`中填入`COOKIE`和推送参数
4. 在`my_config.js`中自定义设置
5. 在当前目录下**打开终端**运行可执行文件`lottery`(勿直接点击`lottery`)
```sh
# unix-like
## 进入脚本所在目录
## 授予执行权限
$ chmod u+x lottery
## 启动脚本
$ ./lottery start
## 检测中奖
$ ./lottery check
## 清理关注动态
$ ./lottery clear
## 下载最新版本
$ ./lottery clear
# windows
## 不需要chmod
## 把`./`换成`.\`或去掉
## 已自带*.bat可直接点击
```
- windows 可直接点击对应的`*.bat`文件
- unix-like
```sh
## 进入脚本所在目录
## 授予执行权限
$ chmod u+x lottery
## 启动脚本
$ ./lottery start
## 检测中奖
$ ./lottery check
## 清理关注动态
$ ./lottery clear
## 下载最新版本
$ ./lottery update
```
7. 运行截图
![lottery_start](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/lottery_start.png)
![lottery_start](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/lottery_start.png)
#### 以源码方式运行
<details>
[点击跳转](doc/run_use_sc.md)
<summary>点击显示详细说明</summary>
##### Windows
step1: 下载代码到本地
[点此下载](https://github.com/shanmiteko/LotteryAutoScript/archive/refs/heads/main.zip)或如图示下载↓
![点我加载下载操作图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/download.png)
下载的压缩包解压后修改env.example.js文件,详见step3
step2: 下载并安装Node.js
[点此进入nodejs下载页面](http://nodejs.cn/download)
![点我加载下载nodejs操作图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/nodejs.png)
step3:修改env.example.js文件及创建运行文件(打开扩展名显示)
1.step1下载的压缩包解压后将其中的`env.example.js`文件重命名为`env.js`
2.右键`env.js`文件选择编辑或用记事本打开
3.填入相关参数
4.`my_config.example.js`同样操作
5.运行
注: `npm i`意味安装依赖, 只需运行一次, 为防止依赖有变化遂每次都执行
命令一: 启动抽奖
```bash
npm i && npm run start
```
命令二: 检查中奖
```bash
npm i && npm run check
```
命令三: 清理动态
```bash
npm i && npm run clear
```
`script`目录下有启动脚本, 点击即可运行
注: **本地运行时可在设置中增大扫描页数**
> ~~[windows系统定时运行](./doc/win_schedule.md)~~
脚本已内置定时运行功能
##### Linux
[linux系统配置与定时运行](./doc/linux_schedule.md)
</details>
----------------------------------------
### Docker
1.初始化
[点击跳转](doc/run_use_docker.md)
```bash
curl -fsSL https://cdn.staticaly.com/gh/shanmiteko/LotteryAutoScript/main/script/docker/init.sh | sudo sh
```
----------------------------------------
进入`lottery`文件夹
### 青龙面板
```bash
cd lottery
```
编辑`env.js`与`my_config.js`文件
- env.js 设置必要环境变量
- my_config.js 你的设置
2.执行相应的脚本
```
$ tree
.
├── check.sh 检查中奖
├── clear.sh 清理动态
├── debug.sh 进入临时容器查看内容
├── env.js
├── my_config.js
├── new_env.js
├── new_my_config.js
├── remove_all.sh 移除对应docker镜像和所有相关容器
└── start.sh 启动抽奖
```
[![asciicast](https://asciinema.org/a/453237.svg)](https://asciinema.org/a/453237)
完成配置后
```sh
$ ./start.sh
```
3.更新
进入lottery上一级目录
使用与初始化相同的命令
[点击跳转](doc/run_use_ql.md)
----------------------------------------
@@ -275,31 +171,32 @@ $ ./start.sh
以下是支持的推送方式
| Name | 归属 | 说明 |
| :---------------: | :--------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SCKEY` | 微信server酱推送(于2021/4月下线) | server酱的微信通知[官方文档](http://sc.ftqq.com/3.version) |
| `SENDKEY` | 微信server酱(Turbo版)推送 | [获取SENDKEY](https://sct.ftqq.com/sendkey) [选择消息通道](https://sct.ftqq.com/forward) |
| `BARK_PUSH` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | IOS用户下载BARK这个APP,填写内容是app提供的`设备码`,例如:<https://api.day.app/123> ,那么此处的设备码就是`123`,再不懂看 [这个图](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/bark.jpg)(注:支持自建填完整链接即可) |
| `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` |
| `TG_BOT_TOKEN` | telegram推送 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](doc/TG_PUSH.md) |
| `TG_USER_ID` | telegram推送 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](doc/TG_PUSH.md) |
| `TG_PROXY_HOST` | Telegram 代理的 IP | 代理类型为 http。例子:http代理 <http://127.0.0.1:1080> 则填写 127.0.0.1 |
| `TG_PROXY_PORT` | Telegram 代理的端口 | 例子:http代理 <http://127.0.0.1:1080> 则填写 1080 |
| `DD_BOT_TOKEN` | 钉钉推送 | 钉钉推送(`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需)[官方文档](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于`=`符号后面的XXX即可 |
| `DD_BOT_SECRET` | 钉钉推送 | (`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需) ,密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的`SECXXXXXXXXXX`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/DD_bot.png) |
| `IGOT_PUSH_KEY` | iGot推送 | iGot聚合推送,支持多方式推送,确保消息可达。 [参考文档](https://wahao.github.io/Bark-MP-helper ) |
| `QQ_SKEY` | 酷推(Cool Push)推送 | 推送所需的Skey,登录后获取Skey [参考文档](https://cp.xuthus.cc/) |
| `QQ_MODE` | 酷推(Cool Push)推送 | 推送方式(send或group或者wx,默认send) [参考文档](https://cp.xuthus.cc/) |
| `QYWX_KEY` | 企业微信推送 | 密钥,企业微信推送 webhook 后面的 key [详见官方说明文档](https://work.weixin.qq.com/api/doc/90000/90136/91770) |
| `PUSH_PLUS_TOKEN` | pushplus推送 | 微信扫码登录后一对一推送或一对多推送下面的token(您的Token) [官方网站](http://pushplus.hxtrip.com/) |
| `PUSH_PLUS_USER` | pushplus推送 | 一对推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码)注:(1、需订阅者扫描二维码 2、如果您是创建群组所属人,也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送),只填`PUSH_PLUS_TOKEN`默认为一对一推送 |
| `QMSG_KEY` | [Qmsg酱](https://qmsg.zendee.cn)私聊推送 | [Qmsg注册](https://qmsg.zendee.cn/login.html) |
| `QMSG_QQ` | 私聊消息推送接口,指定需要接收消息的QQ | 指定的QQ号必须在你的[管理台](https://qmsg.zendee.cn/me.html)已添加 |
| `SMTP_HOST` | 电子邮件 | smtp服务器的主机名 如: `smtp.qq.com` |
| `SMTP_PORT` | 电子邮件 | smtp服务器的端口 如: `465` |
| `SMTP_USER` | 电子邮件 | 发送方的电子邮件 如: `xxxxxxxxx@qq.com` |
| `SMTP_PASS` | 电子邮件 | smtp服务对应的授权码 |
| `SMTP_TO_USER` | 电子邮件 | 接收方电子邮件 |
| Name | 归属 | 说明 |
| :---------------: | :--------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SCKEY` | 微信server酱推送(于2021/4月下线) | server酱的微信通知[官方文档](http://sc.ftqq.com/3.version) |
| `SENDKEY` | 微信server酱(Turbo版)推送 | [获取SENDKEY](https://sct.ftqq.com/sendkey) [选择消息通道](https://sct.ftqq.com/forward) |
| `BARK_PUSH` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | IOS用户下载BARK这个APP,填写内容是app提供的`设备码`,例如:<https://api.day.app/123> ,那么此处的设备码就是`123`,再不懂看 [这个图](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/bark.jpg)(注:支持自建填完整链接即可) |
| `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` |
| `TG_BOT_TOKEN` | telegram推送 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](doc/TG_PUSH.md) |
| `TG_USER_ID` | telegram推送 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](doc/TG_PUSH.md) |
| `TG_PROXY_HOST` | Telegram 代理的 IP | 代理类型为 http。例子:http代理 <http://127.0.0.1:1080> 则填写 127.0.0.1 |
| `TG_PROXY_PORT` | Telegram 代理的端口 | 例子:http代理 <http://127.0.0.1:1080> 则填写 1080 |
| `DD_BOT_TOKEN` | 钉钉推送 | 钉钉推送(`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需)[官方文档](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于`=`符号后面的XXX即可 |
| `DD_BOT_SECRET` | 钉钉推送 | (`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需) ,密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的`SECXXXXXXXXXX`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/DD_bot.png) |
| `IGOT_PUSH_KEY` | iGot推送 | iGot聚合推送,支持多方式推送,确保消息可达。 [参考文档](https://wahao.github.io/Bark-MP-helper ) |
| `QQ_SKEY` | 酷推(Cool Push)推送 | 推送所需的Skey,登录后获取Skey [参考文档](https://cp.xuthus.cc/) |
| `QQ_MODE` | 酷推(Cool Push)推送 | 推送方式(send或group或者wx,默认send) [参考文档](https://cp.xuthus.cc/) |
| `QYWX_AM` | 企业微信应用 | 第一个值是企业id,第二个值是secret,第三个值@all(或者成员id),第四个值是AgentID (逗号分割) 可查看此[教程](http://note.youdao.com/s/HMiudGkb) [官方文档](https://developer.work.weixin.qq.com/document/path/90236) |
| `QYWX_KEY` | 企业微信Bot推送 | 密钥,企业微信推送 webhook 后面的 key [详见官方说明文档](https://work.weixin.qq.com/api/doc/90000/90136/91770) |
| `PUSH_PLUS_TOKEN` | pushplus推送 | 微信扫码登录后一对推送或一对多推送下面的token(您的Token) [官方网站](http://pushplus.hxtrip.com/) |
| `PUSH_PLUS_USER` | pushplus推送 | 一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码)注:(1、需订阅者扫描二维码 2、如果您是创建群组所属人,也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送),只填`PUSH_PLUS_TOKEN`默认为一对一推送 |
| `QMSG_KEY` | [Qmsg酱](https://qmsg.zendee.cn)私聊推送 | [Qmsg注册](https://qmsg.zendee.cn/login.html) |
| `QMSG_QQ` | 私聊消息推送接口,指定需要接收消息的QQ | 指定的QQ号必须在你的[管理台](https://qmsg.zendee.cn/me.html)已添加 |
| `SMTP_HOST` | 电子邮件 | smtp服务器的主机名 如: `smtp.qq.com` |
| `SMTP_PORT` | 电子邮件 | smtp服务器的端口 如: `465` |
| `SMTP_USER` | 电子邮件 | 发送方的电子邮件 如: `xxxxxxxxx@qq.com` |
| `SMTP_PASS` | 电子邮件 | smtp服务对应的授权码 |
| `SMTP_TO_USER` | 电子邮件 | 接收方电子邮件 |
----------------------------------------
@@ -309,6 +206,8 @@ $ ./start.sh
详见[my_config.example.js](./my_config.example.js)文件内部注释
----------------------------------------
## Awesome
相关项目
+3 -3
View File
@@ -4,16 +4,16 @@
.首先在Telegram上搜索[BotFather](https://t.me/BotFather)机器人<br>
![TG_PUSH1](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/TG_PUSH1.png)
![TG_PUSH1](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/TG_PUSH1.png)
Ⅱ.利用[BotFather](https://t.me/BotFather)创建一个属于自己的通知机器人,按照下图中的1、2、3步骤拿到token,格式形如```10xxx4:AAFcqxxxxgER5uw```。填入```TG_BOT_TOKEN```<br>
![TG_PUSH2](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/TG_PUSH2.png)<br>
![TG_PUSH2](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/TG_PUSH2.png)<br>
**新创建的机器人需要跟它发一条消息来开启对话,否则可能会遇到secret填对了但是收不到消息的情况**<br>
Ⅲ.再次在Telegram上搜索[getuserIDbot](https://t.me/getuserIDbot)机器人,获取UserID。填入```TG_USER_ID```<br>
![TG_PUSH3](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/TG_PUSH3.png)
![TG_PUSH3](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/TG_PUSH3.png)
至此,获取**TG_BOT_TOKEN**以及**TG_USER_ID**的教程结束
+1 -1
View File
@@ -73,7 +73,7 @@ PATH=/sbin:/bin:/usr/sbin/:/usr/bin
看看有没有效果
![image-start](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/image-start.png)
![image-start](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/image-start.png)
7.如果本地的脚本需要更新
Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 KiB

After

Width:  |  Height:  |  Size: 221 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

+43
View File
@@ -0,0 +1,43 @@
1.初始化
```bash
curl -fsSL https://cdn.staticaly.com/gh/shanmiteko/LotteryAutoScript/main/script/docker/init.sh | sudo sh
```
进入`lottery`文件夹
```bash
cd lottery
```
编辑`env.js``my_config.js`文件
- env.js 设置必要环境变量
- my_config.js 你的设置
2.执行相应的脚本
```
$ tree
.
├── check.sh 检查中奖
├── clear.sh 清理动态
├── debug.sh 进入临时容器查看内容
├── env.js
├── my_config.js
├── new_env.js
├── new_my_config.js
├── remove_all.sh 移除对应docker镜像和所有相关容器
└── start.sh 启动抽奖
```
[![asciicast](https://asciinema.org/a/453237.svg)](https://asciinema.org/a/453237)
完成配置后
```sh
$ ./start.sh
```
3.更新
进入lottery上一级目录
使用与初始化相同的命令
+17
View File
@@ -0,0 +1,17 @@
1. 脚本初始化
复制脚本内容[qinglong](../script/qinglong/init.sh)
![ql0](pic/ql0.gif)
2. 新建任务
![ql1](pic/ql1.png)
![ql2](pic/ql2.png)
3. 填入cookie 修改设置
![ql3](pic/ql3.gif)
4. 脚本更新即再次运行初始化脚本
+61
View File
@@ -0,0 +1,61 @@
##### Windows
step1: 下载代码到本地
[点此下载](https://github.com/shanmiteko/LotteryAutoScript/archive/refs/heads/main.zip)或如图示下载↓
![点我加载下载操作图示](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/download.png)
下载的压缩包解压后修改env.example.js文件,详见step3
step2: 下载并安装Node.js
[点此进入nodejs下载页面](http://nodejs.cn/download)
![点我加载下载nodejs操作图示](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/nodejs.png)
step3:修改env.example.js文件及创建运行文件(打开扩展名显示)
1.step1下载的压缩包解压后将其中的`env.example.js`文件重命名为`env.js`
2.右键`env.js`文件选择编辑或用记事本打开
3.填入相关参数
4.`my_config.example.js`同样操作
5.运行
注: `npm i`意味安装依赖, 只需运行一次, 为防止依赖有变化遂每次都执行
命令一: 启动抽奖
```bash
npm i && npm run start
```
命令二: 检查中奖
```bash
npm i && npm run check
```
命令三: 清理动态
```bash
npm i && npm run clear
```
`script`目录下有启动脚本, 点击即可运行
注: **本地运行时可在设置中增大扫描页数**
> [windows系统定时运行](./win_schedule.md)
脚本已内置定时运行功能
##### Linux
> [linux系统配置与定时运行](./linux_schedule.md)
脚本已内置定时运行功能
+3 -3
View File
@@ -16,13 +16,13 @@
7.在`操作`页面中点击`新建`,选择操作为`启动程序`,在设置里点击浏览找到`start.bat`文件并选择,在`起始于(可选)(T)`中的空白框里输入`start.bat`文件的目录地址,也就是`程序或脚本(P)``start.bat`的前面那一串目录地址,最后是以`\`结尾的 ,填好东西后按下面`确认`
![点我加载步骤7结果图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/step_menu.png)
![点我加载步骤7结果图示](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/step_menu.png)
8.在`条件`页面中选择`网络`,设定启动条件为任何连接
9.在`设置`页面中选择如图示选项,或者不修改默认设置
![点我加载步骤9结果图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/shezhi_renwu.png)
![点我加载步骤9结果图示](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/shezhi_renwu.png)
10.最后按`确定`
@@ -30,6 +30,6 @@
最后你可以在任务列表中选择已有的任务,右边的操作框中选择`运行`点击,启动计划的任务,如下图所示
![点我加载运行图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/start_renwu.png)
![点我加载运行图示](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/start_renwu.png)
具体看任务是否正常执行,你可以看看自己的账号动态的最新转发,运行成功每几分钟自动转发抽奖动态
+16 -6
View File
@@ -32,12 +32,21 @@ module.exports = Object.freeze({
/**
* 为防止环境变量过长, 请将多账号填在此处
* 以大括号内容为模板依次复制(包含大括号),逗号分割
* ```
* ...
* NUMBER: 1
* ...
* NUMBER: 2
* 以 **大括号内容** 为模板依次复制(包含大括号),逗号分割
*
* ```txt
* [
* {
* ...
* NUMBER: 1
* ...
* },
* {
* ...
* NUMBER: 2
* ...
* }
* ]
* ```
*/
multiple_account_parm: [
@@ -66,6 +75,7 @@ module.exports = Object.freeze({
TG_PROXY_PORT: "",
DD_BOT_TOKEN: "",
DD_BOT_SECRET: "",
QYWX_AM: "",
QYWX_KEY: "",
IGOT_PUSH_KEY: "",
PUSH_PLUS_TOKEN: "",
+7 -10
View File
@@ -7,9 +7,8 @@ const bili = require('./net/bili')
/**
* 是否中奖
* @param {number} num
* @param {string} [note]
*/
async function isMe(num, note = "无") {
async function isMe(num) {
let desp = '';
const
{ notice_key_words, update_session_wait, get_session_wait, check_session_pages } = config,
@@ -23,13 +22,13 @@ async function isMe(num, note = "无") {
.slice(0, unread_at_num)
.forEach(({ at_time, up_uname, business, source_content, url }) => {
desp += '## [at]检测结果\n\n'
desp += '----------------------------------------------------------------\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 += '- - - -\n\n'
});
log.info('中奖检测', '--> OK');
}
@@ -41,12 +40,12 @@ async function isMe(num, note = "无") {
.forEach(({ nickname, uri, source, timestamp }) => {
if (judge(source, notice_key_words)) {
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'
desp += '- - - -\n\n'
}
})
log.info('中奖检测', '--> OK');
@@ -64,12 +63,12 @@ async function isMe(num, note = "无") {
const content = await bili.fetch_session_msgs(talker_id, unread_count);
if (judge(content, notice_key_words)) {
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'
desp += '- - - -\n\n'
}
await bili.updateSessionStatus(talker_id, type, msg_seqno);
await delay(update_session_wait);
@@ -94,8 +93,6 @@ async function isMe(num, note = "无") {
log.info('中奖检测', '--> OK');
}
if (desp) {
desp += `帐号备注: ${note}\n\n`;
desp += '中奖了别忘给脚本(https://github.com/shanmiteko/LotteryAutoScript)点一个Star哦, 赞助一两块也不是不可以_(:з」∠)_\n\n'
log.info('可能中奖了', desp);
await sendNotify(`帐号${num}可能中奖了`, desp);
} else {
+2 -2
View File
@@ -17,7 +17,7 @@ async function getFollowList() {
log.info('获取关注列表', '未能成功获取关注分区id');
return rmup
}
for (let index = 1; index < 42; index++) {
for (let index = 1; index < 100; index++) {
const uids = await bili.getPartitionUID(tagid, index);
await delay(get_partition_wait);
if (!uids.length) break;
@@ -126,4 +126,4 @@ async function clear() {
}
module.exports = { clear }
module.exports = { clear }
+13 -5
View File
@@ -1,4 +1,4 @@
const { log, hasEnv, shuffle, getRandomOne, delay, try_for_each, retryfn } = require('../utils');
const { log, hasEnv, shuffle, getRandomOne, delay, try_for_each, retryfn, appendLotteryInfoFile } = require('../utils');
const { send } = require('../net/http');
const bili = require('../net/bili');
const { sendNotify } = require('../helper/notify');
@@ -66,7 +66,7 @@ class Monitor extends Searcher {
case 2004:
log.warn('账号异常', `UID(${global_var.get('myUID')})异常号只会对部分UP出现关注异常`)
if (!config.is_exception) {
await sendNotify('[动态抽奖]账号异常通知', `UID: ${global_var.get('myUID')}\n\n异常号只会对部分UP出现关注异常\n\n可在设置中令is_exception为true关闭此推送`)
await sendNotify('[动态抽奖]账号异常通知', `UID: ${global_var.get('myUID')}\n异常号只会对部分UP出现关注异常\n可在设置中令is_exception为true关闭此推送\n${log._cache.filter(it => /Error|\[抽奖信息\]/.test(it)).join('\n')}`)
}
config.is_exception = true;
event_bus.emit('Turn_on_the_Monitor')
@@ -74,7 +74,7 @@ class Monitor extends Searcher {
case 2005:
log.warn('关注已达上限', `UID(${global_var.get('myUID')})关注已达上限,已临时进入只转已关注模式`)
if (!config.is_outof_maxfollow) {
await sendNotify('[动态抽奖]关注已达上限', `UID: ${global_var.get('myUID')}\n\n关注已达上限,已临时进入只转已关注模式\n\n可在设置中令is_outof_maxfollow为true关闭此推送`)
await sendNotify('[动态抽奖]关注已达上限', `UID: ${global_var.get('myUID')}\n关注已达上限,已临时进入只转已关注模式\n可在设置中令is_outof_maxfollow为true关闭此推送\n${log._cache.filter(it => /Error|\[抽奖信息\]/.test(it)).join('\n')}`)
}
config.is_outof_maxfollow = true;
config.only_followed = true;
@@ -184,6 +184,7 @@ class Monitor extends Searcher {
case 1008:
case 1009:
case 1010:
case 1011:
case 2002:
case 2003:
case 4001:
@@ -255,7 +256,7 @@ class Monitor extends Searcher {
/** 所有抽奖信息 */
let alllotteryinfo = [];
const
{ check_if_duplicated, set_lottery_info_url, disable_reserve_lottery, sneaktower, key_words, model, chatmodel, chat: chats, relay: relays, block_dynamic_type, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist, use_public_blacklist } = config,
{ check_if_duplicated, save_lottery_info_to_file, set_lottery_info_url, disable_reserve_lottery, reserve_lottery_wait, sneaktower, key_words, model, chatmodel, chat: chats, relay: relays, block_dynamic_type, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist, use_public_blacklist } = config,
now_ts = Date.now() / 1000;
/**
@@ -286,8 +287,13 @@ class Monitor extends Searcher {
log.info('筛选动态', `并发查询本地dyid完毕`);
}
if (lottery_param[0] !== "APIs" && save_lottery_info_to_file && protoLotteryInfo.length) {
log.info("保存抽奖信息", "保存开始")
await appendLotteryInfoFile(lottery_param[1].toString(), protoLotteryInfo)
}
if (lottery_param[0] !== "APIs" && set_lottery_info_url && protoLotteryInfo.length) {
log.info("上传抽奖信息", "开始")
log.info("上传抽奖信息", "上传开始")
await new Promise((resolve) => {
send({
url: set_lottery_info_url,
@@ -410,6 +416,7 @@ class Monitor extends Searcher {
if (hasEnv('NOT_GO_LOTTERY')) {
log.info('NOT_GO_LOTTERY', 'ON');
} else {
await delay(reserve_lottery_wait);
await bili.reserve_lottery(reserve_id)
}
}
@@ -532,6 +539,7 @@ class Monitor extends Searcher {
* - 评论 内容包含敏感信息 1008
* - 评论 重复评论 1009
* - 评论 帐号未登录 1010
* - 评论 关注UP主7天以上的人可发评论 1011
* - 关注 未知错误 2001
* - 关注 您已被对方拉入黑名单 2002
* - 关注 黑名单用户无法关注 2003
+48 -44
View File
@@ -478,64 +478,68 @@ class Searcher {
if (api) {
const { strToJson } = utils;
log.info('获取动态', `开始获取链接(${api})中的抽奖信息`)
send({
url: api,
config: {
redirect: true
},
method: 'GET',
success: ({ body }) => {
if (body.err_msg) {
log.error("从API响应数据中获取抽奖信息", body.err_msg)
resolve(null)
} else {
const raw_lottery_info = strToJson(body).lottery_info;
if (api.startsWith("file://")) {
utils.readLotteryInfoFile(api.substring(7)).then(resolve)
} else {
send({
url: api,
config: {
redirect: true
},
method: 'GET',
success: ({ body }) => {
if (body.err_msg) {
log.error("从API响应数据中获取抽奖信息", body.err_msg)
resolve(null)
} else {
const raw_lottery_info = strToJson(body).lottery_info;
if (raw_lottery_info) {
let { length } = raw_lottery_info;
if (length) {
const lottery_info = raw_lottery_info
.reduce(async (pre, cur) => {
let results = await pre
, { dyid } = cur;
if (raw_lottery_info) {
let { length } = raw_lottery_info;
if (length) {
const lottery_info = raw_lottery_info
.reduce(async (pre, cur) => {
let results = await pre
, { dyid } = cur;
if (!check_if_duplicated || check_if_duplicated >= 2) {
log.info('获取动态', `查看动态(${dyid})是否点赞 (${length--})`)
const card = await bili.getOneDynamicByDyid(dyid)
if (!check_if_duplicated || check_if_duplicated >= 2) {
log.info('获取动态', `查看动态(${dyid})是否点赞 (${length--})`)
const card = await bili.getOneDynamicByDyid(dyid)
if (card) {
await utils.delay(get_dynamic_detail_wait)
if (card) {
await utils.delay(get_dynamic_detail_wait)
const { is_liked } = parseDynamicCard(card)
const { is_liked } = parseDynamicCard(card)
if (is_liked) {
log.info('获取动态', `动态(${dyid})已转发过`)
} else {
cur.is_liked = is_liked
results.push(cur)
if (is_liked) {
log.info('获取动态', `动态(${dyid})已转发过`)
} else {
cur.is_liked = is_liked
results.push(cur)
}
}
} else {
results.push(cur)
}
} else {
results.push(cur)
}
return results
return results
}, Promise.resolve([]))
}, Promise.resolve([]))
resolve(lottery_info)
return
resolve(lottery_info)
return
}
}
log.error("从API响应数据中获取抽奖信息", "非Json数据或没有lottery_info或lottery为空")
resolve(null)
}
log.error("从API响应数据中获取抽奖信息", "非Json数据或没有lottery_info或lottery为空")
},
failure: err => {
log.error("从API响应数据中获取抽奖信息", err)
resolve(null)
}
},
failure: err => {
log.error("从API响应数据中获取抽奖信息", err)
resolve(null)
}
})
})
}
} else {
log.warn('获取动态', `链接为空`)
resolve(null)
+21 -4
View File
@@ -17,7 +17,6 @@ const config = {
Articles: [],
/**
* 从API接口中获取抽奖信息
* @typedef {object} LotteryInfo
* @property {string} lottery_info_type
* @property {number} create_time
@@ -32,11 +31,19 @@ const config = {
* @property {string} des
* @property {number} type
* @property {boolean} hasOfficialLottery 是否官方
* @typedef RespondBody
* @typedef {object} RespondBody
* @property {string} err_msg 错误信息
* @property {LotteryInfo[]} lottery_info
* API传回数据类型 {RespondBody}
*
* - 从API接口中获取抽奖信息
* 获取抽奖信息的链接字符串
* @example
* ["https://github.com/spiritLHL/sync_lottery"]
*
* - 从当前路径下符合要求的文件中获取
* 文件名
* @example
* ["file://lottery_info_1.json"]
*/
APIs: [],
@@ -52,6 +59,11 @@ const config = {
*/
LotteryOrder: [2, 0, 1, 3],
/**
* 保存抽奖信息至文件
*/
save_lottery_info_to_file: false,
/**
* API发送数据类型 {LotteryInfo[]}
* 上传抽奖信息的链接字符串
@@ -170,7 +182,6 @@ const config = {
lottery_loop_wait: 0,
check_loop_wait: 0,
clear_loop_wait: 0,
update_loop_wait: 0,
/**
* - 转发间隔时间
@@ -221,6 +232,12 @@ const config = {
*/
random_dynamic_wait: 2000,
/**
* - 预约抽奖间隔
* - 单位毫秒
*/
reserve_lottery_wait: 6000,
/**
* - up主粉丝数限制
*/
+5 -4
View File
@@ -1,4 +1,4 @@
const { getRemoteConfig, createDir, createFile } = require("../utils");
const { getRemoteConfig, createDir, createFile, dyids_dir } = require("../utils");
const config = require("../data/config");
let global_var = {
@@ -42,12 +42,13 @@ let global_var = {
LotteryOrder
.map(it => LotteryOrderMap.get(it))
.filter(it => typeof it === "string")
.flatMap(lottery_option => config[lottery_option]
.map(it => [lottery_option, it])));
.map(lottery_option => config[lottery_option].map(it => [lottery_option, it]))
.flat()
);
this.set('remoteconfig', await getRemoteConfig());
}
await createDir('dyids');
await createFile(num < 2 ? 'dyid.txt' : `dyid${num}.txt`, '', 'a')
await createFile(dyids_dir, num < 2 ? 'dyid.txt' : `dyid${num}.txt`, '', 'a')
}
};
+94 -3
View File
@@ -43,6 +43,12 @@ let DD_BOT_TOKEN = '';
//密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串
let DD_BOT_SECRET = '';
// ================================企业微信应用通知设置区域====================================
// 此处填你企业微信应用消息的值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236)
// 环境变量名 QYWX_AM 依次填入 corpid,corpsecret,touser(注:多个成员ID使用|隔开),agentid,消息类型(选填,不填默认文本消息类型)
// 注意用,号隔开(英文输入法的逗号),例如:wwcff56746d9adwers,B-791548lnzXBE6_BWfxdf3kSTMJr9vFEPKAbh6WERQ,mingcheng,1000001,2COXgjH2UIfERF2zxrtUOKgQ9XklUqMdGSWLBoW_lSDAdafat
let QYWX_AM = '';
// =======================================企业微信机器人通知设置区域===========================================
//此处填你企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa
//注:此处设置github action用户填写到Settings-Secrets里面(Name输入QYWX_KEY)
@@ -125,6 +131,10 @@ if (process.env.DD_BOT_TOKEN) {
}
}
if (process.env.QYWX_AM) {
QYWX_AM = process.env.QYWX_AM;
}
if (process.env.QYWX_KEY) {
QYWX_KEY = process.env.QYWX_KEY;
}
@@ -164,12 +174,13 @@ if (process.env.SMTP_TO_USER) {
SMTP_TO_USER = process.env.SMTP_TO_USER;
}
//==========================云端环境变量的判断与接收=========================
async function sendNotify(text, desp, params = {}) {
//提供10种通知方式
if (process.env.NOTE) {
desp += `\n帐号备注: ${process.env.NOTE}`
}
//提供多种通知方式
await Promise.all([
//微信server酱
serverNotify(text, desp),
@@ -183,6 +194,8 @@ async function sendNotify(text, desp, params = {}) {
tgBotNotify(text, desp),
//钉钉机器人
ddBotNotify(text, desp),
//企业微信应用
qywxAmNotify(text, desp),
//企业微信机器人
qywxBotNotify(text, desp),
//iGot
@@ -529,6 +542,84 @@ function ddBotNotify(text, desp) {
})
}
function qywxAmNotify(text, desp) {
return new Promise(resolve => {
if (QYWX_AM) {
const QYWX_AM_AY = QYWX_AM.split(',');
send({
method: 'POST',
url: `https://qyapi.weixin.qq.com/cgi-bin/gettoken`,
contents: {
corpid: `${QYWX_AM_AY[0]}`,
corpsecret: `${QYWX_AM_AY[1]}`,
},
config: {
retry: false
},
headers: {
accept: 'application/json, text/plain, */*',
'content-type': 'application/json',
},
success: res => {
try {
const data = JSON.parse(res.body);
let accesstoken = data.access_token;
send({
method: 'POST',
url: `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${accesstoken}`,
contents: {
touser: `${QYWX_AM_AY[2]}`,
agentid: `${QYWX_AM_AY[3]}`,
safe: '0',
msgtype: 'text',
text: {
content: `${text}\n\n${desp}`,
},
},
config: {
retry: false
},
headers: {
accept: 'application/json, text/plain, */*',
'content-type': 'application/json',
},
success: res => {
try {
const data = JSON.parse(res.body);
if (data.errcode === 0) {
log.info('发送通知', '企业微信应用发送通知消息完成。');
} else {
log.error('发送通知', `${data.errmsg}`);
}
} catch (e) {
log.error('发送通知', e);
} finally {
resolve();
}
},
failure: err => {
log.error('发送通知', '企业微信应用发送通知消息失败!!' + err);
resolve();
}
})
} catch (e) {
log.error('发送通知', e);
} finally {
resolve();
}
},
failure: err => {
log.error('发送通知', '企业微信应用发送通知消息失败!!' + err);
resolve();
}
})
} else {
log.debug('发送通知', '您未提供企业微信应用所需的QYWX_AM,取消企业微信应用推送消息通知');
resolve();
}
});
}
function qywxBotNotify(text, desp) {
return new Promise(resolve => {
if (QYWX_KEY) {
+3 -3
View File
@@ -30,11 +30,11 @@ async function randomDynamic(num) {
await utils.try_for_each(
utils.shuffle(dynamics).slice(0, num),
async (dynamic) => {
await utils.delay(random_dynamic_wait)
await utils.delay(random_dynamic_wait);
if (dynamic instanceof Array && dynamic.length === 2 && typeof dynamic[0] === "number") {
return await bili.shareVideo(...dynamic)
await bili.shareVideo(...dynamic)
} else {
return await bili.createDynamic(dynamic)
await bili.createDynamic(dynamic)
}
}
)
+1 -2
View File
@@ -1,7 +1,6 @@
const { isMe } = require('./check');
const { clear } = require('./clear');
const { start } = require('./lottery');
const { update } = require('./update');
const global_var = require('./data/global_var')
const bili = require('./net/bili')
const { log } = require('./utils')
@@ -24,4 +23,4 @@ async function checkCookie(num) {
}
module.exports = { start, isMe, clear, update, checkCookie }
module.exports = { start, isMe, clear, checkCookie }
+5 -7
View File
@@ -34,9 +34,6 @@ async function createRandomDynamic(num) {
function start(num) {
return new Promise(resolve => {
let times = utils.counter();
if (config.notice_running_state) {
sendNotify(`动态抽奖-帐号${num}开始抽奖`, "运行正常")
}
/* 注册事件 */
event_bus.on('Turn_on_the_Monitor', async () => {
const lotterys = global_var.get("Lottery");
@@ -56,11 +53,12 @@ function start(num) {
await (new Monitor(lottery)).init();
});
event_bus.on('Turn_off_the_Monitor', async (msg) => {
if (config.notice_running_state) {
sendNotify(`动态抽奖-帐号${num}结束抽奖`, msg)
}
await createRandomDynamic(config.create_dy_num);
log.info('结束抽奖', '原因: ' + msg);
if (config.notice_running_state) {
sendNotify(`动态抽奖-帐号${num}结束抽奖`, `${log._cache.filter(it => /抽奖\]|Error|\[抽奖信息\]/.test(it)).join('\n')}`);
}
log._cache.length = 0;
await createRandomDynamic(config.create_dy_num);
event_bus.flush();
resolve();
})
+33 -22
View File
@@ -634,9 +634,9 @@ const bili_client = {
(uid) => post({
url: API.RELATION_BATCH_MODIFY,
contents: {
fid: uid,
fids: uid,
act: 1,
re_src: 0,
re_src: 1,
csrf: GlobalVar.get("csrf")
}
})
@@ -858,7 +858,7 @@ const bili_client = {
let
contents = {
csrf: GlobalVar.get("csrf"),
extension: '{"emoji_type":1,"from":{"emoji_type":1},"flag_cfg":{}}'
extension: '{"emoji_type":1,"from":{"emoji_type":1},"flag_cfg":{}}',
},
url = '';
if (content instanceof Array) {
@@ -873,6 +873,7 @@ const bili_client = {
url = API.DYNAMIC_SVR_CREATE
contents = {
...contents,
type: 4,
content,
}
}
@@ -916,27 +917,33 @@ const bili_client = {
* 分享视频
* @param {number} uid
* @param {number} aid
* @return {boolean} isError true
* @return {Promise<boolean>} isError true
*/
async shareVideo(uid, aid) {
const responseText = await post({
url: API.DYNAMIC_REPOST_SHARE,
contents: {
platform: "pc",
uid,
type: 8,
content: "分享视频",
repost_code: 20000,
rid: aid,
csrf_token: GlobalVar.get("csrf")
}
});
if (/^{"code":0/.test(responseText)) {
log.info('转发视频', `成功转发视频(av${aid})`);
return false
} else {
log.error('转发视频', `转发失败\n${responseText}`);
return true
const
responseText = await post({
url: API.DYNAMIC_REPOST_SHARE,
contents: {
platform: "pc",
uid,
type: 8,
content: "分享视频",
repost_code: 20000,
rid: aid,
csrf_token: GlobalVar.get("csrf")
}
}),
res = strToJson(responseText);
switch (res.code) {
case 0:
log.info('转发视频', `成功转发视频(av${aid})`);
return false
case 1101015:
log.warn('转发视频', `该动态不能转发分享(av${aid})`);
return false
default:
log.error('转发视频', `转发失败\n${responseText}`);
return true
}
},
/**
@@ -984,6 +991,7 @@ const bili_client = {
* - 评论内容包含敏感信息 8
* - 重复评论 9
* - 帐号未登录 10
* - 关注UP主7天以上的人可发评论 11
*/
async sendChat(rid, msg, type) {
const
@@ -1028,6 +1036,9 @@ const bili_client = {
case -101:
log.error('自动评论', '帐号未登录');
return 10;
case 12078:
log.error('自动评论', '关注UP主7天以上的人可发评论');
return 11;
default:
log.error('自动评论', `未知错误\n${responseText}`);
return 1;
+7 -8
View File
@@ -65,17 +65,16 @@ async function update() {
.filter(({ name }) => checkPlatform(name))
.map(({ browser_download_url }) => browser_download_url)
if (download_url.length) {
const proxy_host = ['download.fastgit.org']
await try_for_each(download_url.entries(), async ([i, url]) => {
let proxy_url = new URL(url)
proxy_url.host = proxy_host[0]
log.warn('自动下载', `切换代理${proxy_host[0]}`)
await download(proxy_url.href, `latest_version${i}.zip`)
let proxy_url = "https://ghproxy.com/";
proxy_url += url
log.warn('自动下载', `切换代理${proxy_url}`)
await download(proxy_url, `latest_version${i}.zip`)
.catch(async err => {
log.error('自动下载', err)
proxy_url.host = 'github.com'
log.warn('自动下载', `使用原始链接github.com`)
await download(proxy_url.href, `latest_version${i}.zip`)
proxy_url = url
log.warn('自动下载', `使用原始链接${proxy_url}`)
await download(proxy_url, `latest_version${i}.zip`)
})
return false
})
+91 -16
View File
@@ -15,6 +15,8 @@ const utils = {
config_file: path.join(process.cwd(), "my_config.js"),
/**dyids存放目录 */
dyids_dir: path.join(process.cwd(), "dyids"),
/**lottery_info存放目录 */
lottery_info_dir: path.join(process.cwd(), "lottery_info"),
/**dyid长度 */
dyid_length: 18,
/**
@@ -187,8 +189,8 @@ const utils = {
chalk.hex('#64B3FF'), chalk.grey, chalk.hex('#FFA500'),
chalk.hex('#0070BB'), chalk.hex('#48BB31'), chalk.hex('#BBBB23'), chalk.hex('#FF0006')
],
_iso_time: () => new Date(Date.now() + 288e5).toISOString().slice(0, -1) + '+08'
,
_iso_time: () => new Date(Date.now() + 288e5).toISOString().slice(0, -1) + '+08',
_cache: [],
/**
* 初始化默认level为3
*/
@@ -211,10 +213,7 @@ const utils = {
* @returns
*/
rainbow(msg) {
const
colors = ['red', 'yellow', 'green', 'cyan', 'blue', 'magenta'],
colorsCount = colors.length;
this.proPrint(msg.map(it => it.split('').map((l, i) => chalk[colors[i % colorsCount]](l)).join('')), '\n')
this.proPrint(msg.map(it => it.split('').map(l => chalk.hex("#89cff0")(l)).join('')), '\n')
},
/**
* @param {number} done
@@ -230,20 +229,50 @@ const utils = {
debug(context, msg) {
if (this._level > 3) {
if (msg instanceof Object) msg = JSON.stringify(msg, null, 4);
this.proPrint([this._colors[0](`[${this._iso_time()}]`), this._colors[1]("[Debug]"), this._colors[2](`[${context}]`), this._colors[3](`[\n${msg}\n]`)])
let color_text_pair = [
[this._colors[0], `[${this._iso_time()}]`],
[this._colors[1], "[Debug]"],
[this._colors[2], `[帐号${process.env["NUMBER"]} ${context}]`],
[this._colors[3], `[\n${msg}\n]`],
];
this.proPrint(color_text_pair.map(([color, text]) => color(text)))
}
},
info(context, msg) {
if (this._level > 2)
this.proPrint([this._colors[0](`[${this._iso_time()}]`), this._colors[1]("[Info]"), this._colors[2](`[${context}]`), this._colors[4](`[${msg}]`)])
if (this._level > 2) {
let color_text_pair = [
[this._colors[0], `[${this._iso_time()}]`],
[this._colors[1], "[Info]"],
[this._colors[2], `[帐号${process.env["NUMBER"]} ${context}]`],
[this._colors[4], `[${msg}]`],
];
this._cache.push(color_text_pair.map(it => it[1]).join(' '));
this.proPrint(color_text_pair.map(([color, text]) => color(text)))
}
},
warn(context, msg) {
if (this._level > 1)
this.proPrint([this._colors[0](`[${this._iso_time()}]`), this._colors[1]("[Warn]"), this._colors[2](`[${context}]`), this._colors[5](`[\n${msg}\n]`)])
if (this._level > 1) {
let color_text_pair = [
[this._colors[0], `[${this._iso_time()}]`],
[this._colors[1], "[Warn]"],
[this._colors[2], `[帐号${process.env["NUMBER"]} ${context}]`],
[this._colors[5], `[\n${msg}\n]`],
];
this._cache.push(color_text_pair.map(it => it[1]).join(' '));
this.proPrint(color_text_pair.map(([color, text]) => color(text)))
}
},
error(context, msg) {
if (this._level > 0)
this.proPrint([this._colors[0](`[${this._iso_time()}]`), this._colors[1]("[Error]"), this._colors[2](`[${context}]`), this._colors[6](`[\n${msg}\n]`)])
if (this._level > 0) {
let color_text_pair = [
[this._colors[0], `[${this._iso_time()}]`],
[this._colors[1], "[Error]"],
[this._colors[2], `[帐号${process.env["NUMBER"]} ${context}]`],
[this._colors[6], `[\n${msg}\n]`],
];
this._cache.push(color_text_pair.map(it => it[1]).join(' '));
this.proPrint(color_text_pair.map(([color, text]) => color(text)))
}
}
},
/**
@@ -343,13 +372,14 @@ const utils = {
},
/**
* CreateFile
* @param {string} filepath 相对于dyids的文件路径
* @param {string} basename
* @param {string} filename
* @param {string} [defaultValue] 写入默认值
* @param {string} flag
* @returns {Promise<void>}
*/
createFile(filepath, defaultValue, flag) {
const fpath = path.join(utils.dyids_dir, filepath);
createFile(basename, filename, defaultValue, flag) {
const fpath = path.join(basename, filename);
const buffer = Buffer.from(defaultValue);
return new Promise((resolve, rejects) => {
fs.open(fpath, flag, (err, fd) => {
@@ -384,6 +414,51 @@ const utils = {
writeDyidFile(num) {
const fpath = num < 2 ? path.join(utils.dyids_dir, 'dyid.txt') : path.join(utils.dyids_dir, `dyid${num}.txt`);
return fs.createWriteStream(fpath, { flags: 'a' })
},
/**
* 追加lotteryinfo
* @param {string} from
* @param {import("./core/searcher").LotteryInfo[]} lottery_info
* @return {Promise<void>}
*/
async appendLotteryInfoFile(from, lottery_info) {
let all_lottery_info = {};
try {
all_lottery_info = utils.strToJson(fs.readFileSync(path.join(utils.lottery_info_dir, `lottery_info_${Number(process.env.NUMBER)}.json`)).toString())
} catch (_) {
all_lottery_info = {}
}
await utils.createDir(utils.lottery_info_dir);
if (all_lottery_info[from] instanceof Array) {
all_lottery_info[from].push(...lottery_info)
} else {
all_lottery_info[from] = lottery_info
}
await utils.createFile(utils.lottery_info_dir, `lottery_info_${Number(process.env.NUMBER)}.json`, JSON.stringify(all_lottery_info), "w")
},
/**
* 读取lottery_info
* @param {string} filename
* @return {Promise<import("./core/searcher").LotteryInfo[]>}
*/
readLotteryInfoFile(filename) {
return new Promise((resolve) => {
fs.readFile(path.join(utils.lottery_info_dir, filename), (err, data) => {
if (err) {
resolve([])
} else {
let all_lottery_info = utils.strToJson(data.toString('utf8'));
resolve(Object.values(all_lottery_info).flat())
}
})
});
},
/**
* 清空lottery_info file
*/
async clearLotteryInfo() {
await utils.createDir(utils.lottery_info_dir);
await utils.createFile(utils.lottery_info_dir, `lottery_info_${Number(process.env.NUMBER)}.json`, "{}", "w")
}
};
+15 -10
View File
@@ -1,4 +1,4 @@
const { version: ve, env_file, config_file, log, hasEnv, delay, hasFileOrDir } = require("./lib/utils");
const { version: ve, env_file, config_file, log, hasEnv, delay, hasFileOrDir, clearLotteryInfo } = require("./lib/utils");
const metainfo = [
` _ _ _ _____ _ _ `,
@@ -21,7 +21,7 @@ let loop_wait = 0;
* @returns {Promise<string>} 错误信息
*/
async function main() {
const { COOKIE, NOTE, NUMBER, CLEAR, ENABLE_MULTIPLE_ACCOUNT, MULTIPLE_ACCOUNT_PARM } = process.env;
const { COOKIE, NUMBER, CLEAR, ENABLE_MULTIPLE_ACCOUNT, MULTIPLE_ACCOUNT_PARM } = process.env;
if (ENABLE_MULTIPLE_ACCOUNT) {
let muti_acco = multiple_account.length
? multiple_account
@@ -49,24 +49,27 @@ async function main() {
await global_var.init(COOKIE, NUMBER);
/**引入基础功能 */
const { start, isMe, clear, update, checkCookie } = require("./lib/index");
const { start, isMe, clear, checkCookie } = require("./lib/index");
log.info('main', '当前为第' + NUMBER + '个账号');
if (await checkCookie(NUMBER)) {
const mode = process.env.lottery_mode;
const help_msg = "用法: lottery [OPTIONS]\n\nOPTIONS:\n\tstart 启动抽奖\n\tcheck 中奖检查\n\tclear 清理动态和关注\n\tupdate 检查更新\n\thelp 帮助信息";
const { lottery_loop_wait, check_loop_wait, clear_loop_wait, update_loop_wait } = require("./lib/data/config");
const { lottery_loop_wait, check_loop_wait, clear_loop_wait, save_lottery_info_to_file } = require("./lib/data/config");
switch (mode) {
case 'start':
log.info('抽奖', '开始运行');
loop_wait = lottery_loop_wait;
if (save_lottery_info_to_file) {
await clearLotteryInfo()
}
await start(NUMBER);
break;
case 'check':
log.info('中奖检测', '检查是否中奖');
loop_wait = check_loop_wait;
await isMe(NUMBER, NOTE);
await isMe(NUMBER);
break;
case 'clear':
if (CLEAR) {
@@ -75,11 +78,6 @@ async function main() {
await clear();
}
break;
case 'update':
log.info('检查更新', '开始')
loop_wait = update_loop_wait;
await update()
break;
case 'help':
return help_msg
case undefined:
@@ -150,6 +148,13 @@ function initConfig() {
/**OPTIONS */
process.env.lottery_mode = process.argv[2]
if (process.env.lottery_mode === "update") {
log.info('检查更新', '开始')
await require("./lib/update").update()
log.info('检查更新', '请手动解压替换可执行文件')
return
}
const err_msg = await main();
if (err_msg) {
log.error('错误', err_msg);
+46 -20
View File
@@ -6,30 +6,19 @@ module.exports = Object.freeze({
/**
* 监视更转的用户uid
*/
UIDs: [
689277291,
241675899
],
UIDs: [],
/**
* 监视的tag
*/
TAGs: [
'互动抽奖',
'转发抽奖',
'动态抽奖',
'抽奖',
],
TAGs: [],
/**
* 监视的专栏关键词
*/
Articles: [
'抽奖合集'
],
Articles: [],
/**
* 从API接口中获取抽奖信息
* @typedef {object} LotteryInfo
* @property {string} lottery_info_type
* @property {number} create_time
@@ -44,15 +33,21 @@ module.exports = Object.freeze({
* @property {string} des
* @property {number} type
* @property {boolean} hasOfficialLottery 是否官方
* @typedef RespondBody
* @typedef {object} RespondBody
* @property {string} err_msg 错误信息
* @property {LotteryInfo[]} lottery_info
* API传回数据类型 {RespondBody}
*
* - 从API接口中获取抽奖信息
* 获取抽奖信息的链接字符串
* @example
* "https://github.com/spiritLHL/sync_lottery"
* ["https://github.com/spiritLHL/sync_lottery"]
*
* - 从当前路径下符合要求的文件中获取
* 文件名
* @example
* ["file://lottery_info_1.json"]
*/
APIs: [],
APIs: ["file://lottery_info_1.json"],
/**
* 抽奖参与顺序组合
@@ -66,6 +61,11 @@ module.exports = Object.freeze({
*/
LotteryOrder: [2, 0, 1, 3],
/**
* 保存抽奖信息至文件
*/
save_lottery_info_to_file: false,
/**
* API发送数据类型 {LotteryInfo[]}
* 上传抽奖信息的链接字符串
@@ -183,7 +183,6 @@ module.exports = Object.freeze({
lottery_loop_wait: 0,
check_loop_wait: 0,
clear_loop_wait: 0,
update_loop_wait: 0,
/**
* - 转发间隔时间
@@ -234,6 +233,12 @@ module.exports = Object.freeze({
*/
random_dynamic_wait: 2000,
/**
* - 预约抽奖间隔
* - 单位毫秒
*/
reserve_lottery_wait: 6000,
/**
* - up主粉丝数限制
*/
@@ -429,7 +434,28 @@ module.exports = Object.freeze({
* 针对某一账号的特别设置
* config_[数字] 依次类推
*/
config_1: {},
config_1: {
/**
* 手动添加抽奖号UID
* - 抽奖动态下的二级小号
*/
UIDs: [],
TAGs: [
'互动抽奖',
'转发抽奖',
'动态抽奖',
'抽奖',
],
Articles: [
'抽奖合集'
],
APIs: [],
save_lottery_info_to_file: true,
},
config_2: {},
config_3: {}
})
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "lottery-auto-script",
"version": "2.6.1",
"version": "2.6.8",
"description": "自动参与B站动态抽奖",
"main": "main.js",
"scripts": {
+8 -3
View File
@@ -24,13 +24,18 @@ if [[ -z "$1" ]]; then
fi
mkdir -p $TARGET_DIR
npm install
if [[ "$1" == *"arm"* ]]; then
podman build -f Dockerfile.pkg-arm64 -t pkg-arm64
podman run -it --rm -v ${PWD}/dist:/root/lottery/dist pkg-arm64
OUTFILE="$TARGET_DIR/lottery-auto-script-node18-$1"
sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
podman run -it \
--rm \
-v ${PWD}:/root/lottery \
shanmite/pkg-arm64 -t "node18.5.0-$1" -o "$OUTFILE" .
elif [[ "$1" == *"x64"* ]]; then
OUTFILE="$TARGET_DIR/lottery-auto-script-$1"
npx pkg -t "$1" -o $OUTFILE .
npx pkg -t "$1" -o "$OUTFILE" .
fi
for file in "$TARGET_DIR/"*; do
+7 -7
View File
@@ -49,7 +49,7 @@ docker -v && docker pull $DOCKER_REPO
echo "create start.sh"
cat >start.sh <<EOF
#!/bin/sh
#!/bin/env bash
NAME=shanmite-lottery-start
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
docker run \\
@@ -70,7 +70,7 @@ chmod +x start.sh
echo "create check.sh"
cat >check.sh <<EOF
#!/bin/sh
#!/bin/env bash
NAME=shanmite-lottery-check
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
docker run \\
@@ -91,7 +91,7 @@ chmod +x check.sh
echo "create clear.sh"
cat >clear.sh <<EOF
#!/bin/sh
#!/bin/env bash
NAME=shanmite-lottery-clear
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
docker run \\
@@ -112,14 +112,14 @@ chmod +x clear.sh
echo "create debug.sh"
cat >debug.sh <<EOF
#!/bin/sh
#!/bin/env bash
NAME=shanmite-lottery-debug
echo "create temporary debug container"
docker run \\
-it \\
--name \$NAME \\
--entrypoint /bin/sh \\
$DOCKER_REPO -c sh
--entrypoint /bin/bash \\
$DOCKER_REPO -c bash
echo "remove temporary debug container"
docker rm -v \$NAME
EOF
@@ -127,7 +127,7 @@ chmod +x debug.sh
echo "create remove_all.sh"
cat >remove_all.sh <<EOF
#!/bin/sh
#!/bin/env bash
echo "remove all containers about $DOCKER_REPO"
docker rm -v \$(docker ps -a | awk '/shanmite\/lottery_auto_docker/ {print \$1}')
echo "remove image $DOCKER_REPO"
+43
View File
@@ -0,0 +1,43 @@
#!/bin/env bash
set -e
NAME=LotteryAutoScript
# 视网络情况选择链接
GIT_REPO=https://github.com/shanmiteko/${NAME}.git
# GIT_REPO=https://ghproxy.com/https://github.com/shanmiteko/${NAME}.git
if [ -d "$NAME" ]; then
cd $NAME
git pull
cd ..
else
git clone $GIT_REPO $NAME --depth=1
fi
if [ -f "$NAME/my_config.js" ]; then
echo 'my_config 已存在'
else
cp $NAME/my_config.example.js $NAME/my_config.js
fi
if [ -f "$NAME/env.js" ]; then
echo 'env.js 已存在'
else
cp $NAME/env.example.js $NAME/env.js
fi
function create() {
cat >"${NAME}_$1.sh" <<EOF
#!/bin/env bash
cd $NAME
npm run $1
EOF
}
create start
create check
create clear
cd $NAME
npm i
+8 -1
View File
@@ -24,8 +24,15 @@ const util = require('./util');
1),
3
)
}, async () => {
},
async () => {
assert.notEqual((await bili_client.searchArticlesByKeyword("专栏")).length, 0)
},
async () => {
assert.notEqual(await bili_client.sendChat("703886913053917267", "t", 17), 1)
},
async () => {
// assert(!await bili_client.createDynamic("123"))
}
])
+1 -1
View File
@@ -3,7 +3,7 @@ const global_var = require("../lib/data/global_var");
const { log } = require('../lib/utils');
const fs = require('fs');
log._level = 0
log._level = 1
env.init()
global_var.init(process.env["COOKIE"], 1)