fix: 黑名单处理(#22)

This commit is contained in:
shanmite 2021-09-09 13:57:04 +00:00
parent e6dc9d7abb
commit a2591f260a
6 changed files with 92 additions and 28 deletions

42
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: "Build and push Docker images"
on:
push:
branches:
- main
paths:
- "lib/**"
- "main.js"
pull_request:
branches:
- main
paths:
- "lib/**"
- "main.js"
workflow_dispatch:
branches:
- main
jobs:
path-context:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: shanmite/lottery_auto_docker:latest

View File

@ -1,17 +1,17 @@
name: 'Package Node.js project into an executable'
name: "Package Node.js project into an executable"
on:
push:
branches:
- main
paths:
- 'lib/**'
- 'main.js'
- "lib/**"
- "main.js"
pull_request:
branches:
- main
paths:
- 'lib/**'
- 'main.js'
- "lib/**"
- "main.js"
workflow_dispatch:
branches:
- main
@ -19,17 +19,17 @@ jobs:
pkg_x64:
runs-on: windows-latest
steps:
- name: 'Checkout codes'
- name: "Checkout codes"
uses: actions/checkout@v2
- name: 'Use Node.js'
- name: "Use Node.js"
uses: actions/setup-node@v1
with:
node-version: '16'
- name: 'Pkg this'
node-version: "16"
- name: "Pkg this"
run: |
npm install
npm run pkg_x64
- name: 'Upload to artifact'
- name: "Upload to artifact"
uses: actions/upload-artifact@v2
with:
name: dist_x64
@ -37,17 +37,17 @@ jobs:
pkg_arm64:
runs-on: ubuntu-latest
steps:
- name: 'Checkout codes'
- name: "Checkout codes"
uses: actions/checkout@v2
- name: 'Use Node.js'
- name: "Use Node.js"
uses: actions/setup-node@v1
with:
node-version: '16'
- name: 'Pkg this'
node-version: "16"
- name: "Pkg this"
run: |
npm install
npm run pkg_arm64
- name: 'Upload to artifact'
- name: "Upload to artifact"
uses: actions/upload-artifact@v2
with:
name: nlts-linux-arm64
@ -55,18 +55,18 @@ jobs:
pkg_armv7:
runs-on: ubuntu-latest
steps:
- name: 'Checkout codes'
- name: "Checkout codes"
uses: actions/checkout@v2
- name: 'Use Node.js'
- name: "Use Node.js"
uses: actions/setup-node@v1
with:
node-version: '16'
- name: 'Pkg this'
node-version: "16"
- name: "Pkg this"
run: |
npm install
npm run pkg_armv7
- name: 'Upload to artifact'
- name: "Upload to artifact"
uses: actions/upload-artifact@v2
with:
name: nlts-linux-armv7
path: dist/
path: dist/

View File

@ -33,6 +33,8 @@
## 操作步骤
**使用前务必阅读此教程和配置文件内注释**
右上角<kbd>★ Star</kbd>
↓↓
@ -93,8 +95,11 @@ Chrome浏览器:
3. 在`env.js`中填入`COOKIE`和推送参数
4. 在`my_config.js`中自定义设置
5. 在当前目录下**打开终端**运行可执行文件`lottery`(勿直接点击`lottery`)
6. 键入`lottery start`启动抽奖|`lottery check`检测中奖|`lottery clear`清理动态
> 或者新建文本文档写入`lottery start`然后更改扩展名为.bat点击运行
- `lottery start` 启动抽奖
- `lottery check` 检测中奖
- `lottery clear` 清理动态
或者 新建文本文档写入`lottery start`然后更改扩展名为.bat点击运行(已自带start.bat可直接点击)
7. 运行截图
![lottery_start](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/lottery_start.png)

View File

@ -339,11 +339,13 @@ class Monitor extends Searcher {
for (let times = 0; times < max_retry_times; times++) {
status = await bili.sendChat(rid, utils.getRandomOne(config.chat), chat_type)
if (status === -1) {
log.warn('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
return 0
}
if (!status) {
break
}
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
log.info('自动评论', `将在 ${times + 1} 分钟后再次发送评论(${times + 1}/${max_retry_times})`)
await utils.delay(60 * 1000 * (times + 1))
}
@ -354,15 +356,27 @@ class Monitor extends Searcher {
const [u1, u2] = uid
if (u1) {
let status = await bili.autoAttention(u1)
if (status) return 20 + status;
if (status) {
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
return 20 + status
};
status = await bili.movePartition(u1, this.tagid)
if (status) return 20 + status;
if (status) {
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
return 20 + status
};
if (u2) {
utils.delay(5000)
status = await bili.autoAttention(u2)
if (status) return 20 + status;
if (status) {
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
return 20 + status
};
status = await bili.movePartition(u2, this.tagid)
if (status) return 20 + status;
if (status) {
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
return 20 + status
};
}
}

View File

@ -764,6 +764,9 @@ const bili_client = {
show && log.error('自动评论', '需要输入验证码');
return 1
} else if (res.code === 12035) {
show && log.error('自动评论', `已被对方拉入黑名单`);
return -1
} else if (res.code === 12053) {
show && log.error('自动评论', '黑名单用户无法互动');
return -1
} else {

View File

@ -1,6 +1,6 @@
{
"name": "lottery-auto-script",
"version": "2.1.3",
"version": "2.1.4",
"description": "自动参与B站动态抽奖",
"main": "main.js",
"scripts": {