mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
949d580c65 | ||
|
|
51ec0a191f | ||
|
|
9bb9268b96 | ||
|
|
2294ad9f3f | ||
|
|
fe0258a84a | ||
|
|
a14af8e710 | ||
|
|
e0c18b0a1a | ||
|
|
ad6289006f | ||
|
|
1c369415ef | ||
|
|
2f4734c9de | ||
|
|
8e63e072dd | ||
|
|
d879c6336f | ||
|
|
a1a0474299 | ||
|
|
3af17e59ed | ||
|
|
d3cc24c43b | ||
|
|
acd2121d97 | ||
|
|
a2c461b22a | ||
|
|
abe660b717 | ||
|
|
7aa82fe412 | ||
|
|
08a6359579 | ||
|
|
33a1d1a38b | ||
|
|
d0a0dd9219 | ||
|
|
d40daa2b0a | ||
|
|
a0856faa4e | ||
|
|
7172e58d28 | ||
|
|
30bf989aa3 | ||
|
|
15c1d22469 |
@@ -16,18 +16,18 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v4
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ secrets.DOCKERHUB_REPO }}
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Mirror + trigger CI
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
name: "Publishing to NPM"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "package.json"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
+15
-17
@@ -26,31 +26,29 @@ jobs:
|
||||
nodev: 18
|
||||
- platform: win
|
||||
nodev: 18
|
||||
# - platform: win
|
||||
# nodev: 12
|
||||
steps:
|
||||
- name: "Checkout codes"
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "*"
|
||||
- name: "Pkg this"
|
||||
run: |
|
||||
npm run pkg "node${{ matrix.nodev }}-${{ matrix.platform }}-x64"
|
||||
- name: "Upload to artifact"
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: node${{ matrix.nodev }}-${{ matrix.platform }}-x64
|
||||
path: "dist/*.zip"
|
||||
- name: "Upload to release draft"
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
file: "dist/*.zip"
|
||||
files: "dist/*.zip"
|
||||
tag_name: "v2"
|
||||
overwrite: true
|
||||
draft: true
|
||||
overwrite_files: true
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
arm64:
|
||||
runs-on: ubuntu-latest
|
||||
name: node18-${{ matrix.platform }}-arm64
|
||||
@@ -62,20 +60,20 @@ jobs:
|
||||
- platform: alpine
|
||||
steps:
|
||||
- name: "Checkout codes"
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
- name: "Pkg this"
|
||||
run: |
|
||||
npm run pkg "node18-${{ matrix.platform }}-arm64"
|
||||
- name: "Upload to artifact"
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: node18-${{ matrix.platform }}-arm64
|
||||
path: "dist/*.zip"
|
||||
- name: "Upload to release draft"
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
file: "dist/*.zip"
|
||||
files: "dist/*.zip"
|
||||
tag_name: "v2"
|
||||
overwrite: true
|
||||
draft: true
|
||||
overwrite_files: true
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
@@ -1,5 +1,50 @@
|
||||
<!-- markdownlint-disable MD036 MD024-->
|
||||
# CHANGELOG
|
||||
## 主要变化(2.11.2)
|
||||
* 51ec0a1 feat: 获取视频动态的简介以参与转发抽奖
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.11.1)
|
||||
* 2294ad9 fix: ai返回增加类型检查
|
||||
* fe0258a feat: ai过滤过期抽奖
|
||||
* a14af8e fix: ai模式带话题和错误at好友
|
||||
* e0c18b0 chore: 更新action
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.11.0)
|
||||
* 1c36941 fix: origin is null
|
||||
* 2f4734c chore: 不再推送至npm
|
||||
* 8e63e07 fix: @信息未获取导致转发错误标蓝
|
||||
* d879c63 fix: 转发类型动态获取不到rid无法评论 (#466)
|
||||
* a1a0474 fix: 监控uid模式获取不到动态内容
|
||||
* 3af17e5 feat: 可在设置接入AI判断动态是否是抽奖动态
|
||||
* d3cc24c feat: debug日志输出网络请求
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.10.3)
|
||||
* a2c461b fix: clear异常循环 (#484)
|
||||
* abe660b fix: prevent is_repost_then_chat from overriding AI-generated comments (#485)
|
||||
* 7aa82fe feat: Integrate Feishu for notification (#482)
|
||||
* 08a6359 fix: `is_charge_lottery`默认false
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.10.2)
|
||||
* d0a0dd9 feat: 新增QMSG_SOCKET推送参数支持私有云 (#473)
|
||||
* d40daa2 docs: 注解默认设置
|
||||
* a0856fa fix: 风控导致动态内容为空 (#465)
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.10.1)
|
||||
* 30bf989 feat: ai评论支持所有兼容OpenAI API的平台 (#463)
|
||||
* 15c1d22 fix: 官方非官方抽奖类型判断 (#461)
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.10.0)
|
||||
* b74bb02 feat: ai 评论 (#462)
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
[](https://github.com/shanmiteko/LotteryAutoScript/actions/workflows/docker.yml)
|
||||
|
||||
[](https://github.com/shanmiteko/LotteryAutoScript/actions/workflows/npmp.yml)
|
||||
|
||||
[](https://github.com/shanmiteko/LotteryAutoScript/actions/workflows/mirror.yml)
|
||||
|
||||
已实现功能:
|
||||
@@ -33,7 +31,7 @@
|
||||
- 监控用户转发
|
||||
- 监控话题页面
|
||||
- 监控专栏合集
|
||||
- 自动点赞、评论、乱序转发、@好友、带话题、可选随机动态
|
||||
- 自动点赞、AI评论、乱序转发、@好友、带话题、可选随机动态
|
||||
- 直播预约抽奖
|
||||
- 检测是否中奖
|
||||
- 已读@
|
||||
@@ -198,42 +196,47 @@ buvid3亦可不填 使用随机生成值
|
||||
|
||||
关键词有限 可能会有**漏掉**的或**误报**
|
||||
|
||||
可在设置开启AI判断
|
||||
|
||||
### 中奖推送
|
||||
|
||||
> 填写在env.js内
|
||||
|
||||
以下是支持的推送方式
|
||||
|
||||
| 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`,再不懂看 [这个图](doc/pic/bark.jpg)(注:支持自建填完整链接即可) |
|
||||
| `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` |
|
||||
| `PUSHDEER_URL` | [Pushdeer](https://github.com/easychen/pushdeer) | 推送api 默认: <https://api2.pushdeer.com/message/push> |
|
||||
| `PUSHDEER_PUSHKEY` | [Pushdeer](https://github.com/easychen/pushdeer) | PushKey |
|
||||
| `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`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](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` | 电子邮件 | 接收方电子邮件 |
|
||||
| `GOTIFY_URL` | gotify推送 | gotify消息推送地址(例如 http://localhost:8008/message),[官方文档](https://gotify.net/docs/) |
|
||||
| `GOTIFY_APPKEY` | gotify推送 | 一个gotify application的token,[官方文档](https://gotify.net/docs/) |
|
||||
| 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`,再不懂看 [这个图](doc/pic/bark.jpg)(注:支持自建填完整链接即可) |
|
||||
| `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` |
|
||||
| `PUSHDEER_URL` | [Pushdeer](https://github.com/easychen/pushdeer) | 推送api 默认: <https://api2.pushdeer.com/message/push> |
|
||||
| `PUSHDEER_PUSHKEY` | [Pushdeer](https://github.com/easychen/pushdeer) | PushKey |
|
||||
| `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`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](doc/pic/DD_bot.png) |
|
||||
| `FS_BOT_WEBHOOK` | 飞书机器人 | 飞书机器人 webhook,创建自定义机器人后复制 webhook 地址,[官方文档](https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot) |
|
||||
| `FS_BOT_SECRET` | 飞书机器人 | 飞书机器人安全设置中的签名密钥(若开启“签名校验”则必填),[官方文档](https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot) |
|
||||
| `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_SOCKET` | [Qmsg酱](https://qmsg.zendee.cn)私聊推送 | 私有云IP:私有云WEB端口 默认`qmsg.zendee.cn` |
|
||||
| `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` | 电子邮件 | 接收方电子邮件 |
|
||||
| `GOTIFY_URL` | gotify推送 | gotify消息推送地址(例如 http://localhost:8008/message),[官方文档](https://gotify.net/docs/) |
|
||||
| `GOTIFY_APPKEY` | gotify推送 | 一个gotify application的token,[官方文档](https://gotify.net/docs/) |
|
||||
|
||||
----------------------------------------
|
||||
|
||||
|
||||
+23
-13
@@ -6,16 +6,20 @@ module.exports = Object.freeze({
|
||||
* - `NUMBER` 表示是第几个账号
|
||||
* - `CLEAR` 是否启用清理功能
|
||||
* - `ACCOUNT_UA` 账号UA, 可在浏览器控制台输入 navigator.userAgent 查看
|
||||
*
|
||||
* ## 高级功能
|
||||
* - `ENABLE_CHAT_CAPTCHA_OCR` 开启评论验证码识别 使用方法见README
|
||||
* - `CHAT_CAPTCHA_OCR_URL` 验证码识别接口 POST `url`->`code`
|
||||
* - `ENABLE_MULTIPLE_ACCOUNT` 是否启用多账号
|
||||
* - `MULTIPLE_ACCOUNT_PARM` 多账号参数(JSON格式) <不推荐使用
|
||||
* - `ENABLE_AI_JUDGE` 是否启用AI判断抽奖过滤过期抽奖
|
||||
* - `ENABLE_AI_COMMENTS` 是否启用AI评论
|
||||
*
|
||||
* ## 调试相关
|
||||
* - `LOTTERY_LOG_LEVEL` 输出日志等级 Error<Warn<Notice<Info<Debug 0<1<2<3<4
|
||||
* - `NOT_GO_LOTTERY` 关闭抽奖行为
|
||||
*
|
||||
* ## 多账号
|
||||
* - `ENABLE_MULTIPLE_ACCOUNT` 是否启用多账号
|
||||
* - `MULTIPLE_ACCOUNT_PARM` 多账号参数(JSON格式) <不推荐使用
|
||||
* 1. 将 ENABLE_MULTIPLE_ACCOUNT 的值改为true
|
||||
* 2. 将账号信息依次填写于 multiple_account_parm 中, 参考例子类推
|
||||
* - `WAIT` 表示下一个账号运行等待时间(毫秒)
|
||||
@@ -31,9 +35,12 @@ module.exports = Object.freeze({
|
||||
|
||||
ENABLE_CHAT_CAPTCHA_OCR: false,
|
||||
CHAT_CAPTCHA_OCR_URL: 'http://127.0.0.1:9898/ocr/url/text',
|
||||
ENABLE_MULTIPLE_ACCOUNT: false,
|
||||
ENABLE_AI_JUDGE: false,
|
||||
ENABLE_AI_COMMENTS: false,
|
||||
|
||||
ENABLE_MULTIPLE_ACCOUNT: false,
|
||||
MULTIPLE_ACCOUNT_PARM: '',
|
||||
|
||||
LOTTERY_LOG_LEVEL: 3,
|
||||
NOT_GO_LOTTERY: ''
|
||||
},
|
||||
@@ -65,10 +72,10 @@ module.exports = Object.freeze({
|
||||
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',
|
||||
PROXY_HOST:'',//代理ip
|
||||
PROXY_PORT:'',//代理ip端口
|
||||
PROXY_USER:'',//代理ip账号
|
||||
PROXY_PASS:'',//代理ip密码
|
||||
PROXY_HOST: '',//代理ip
|
||||
PROXY_PORT: '',//代理ip端口
|
||||
PROXY_USER: '',//代理ip账号
|
||||
PROXY_PASS: '',//代理ip密码
|
||||
}
|
||||
],
|
||||
|
||||
@@ -95,6 +102,7 @@ module.exports = Object.freeze({
|
||||
IGOT_PUSH_KEY: '',
|
||||
PUSH_PLUS_TOKEN: '',
|
||||
PUSH_PLUS_USER: '',
|
||||
QMSG_SOCKET: '',
|
||||
QMSG_KEY: '',
|
||||
QMSG_QQ: '',
|
||||
SMTP_HOST: '',
|
||||
@@ -103,16 +111,18 @@ module.exports = Object.freeze({
|
||||
SMTP_PASS: '',
|
||||
SMTP_TO_USER: '',
|
||||
GOTIFY_URL: '',
|
||||
GOTIFY_APPKEY: ''
|
||||
GOTIFY_APPKEY: '',
|
||||
FS_BOT_WEBHOOK: '',
|
||||
FS_BOT_SECRET: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* ai相关参数
|
||||
* AI Authentication(OpenAI 兼容的 API 格式)
|
||||
* Chat completions
|
||||
* 此处填写Key, 在my_config中的ai_comments_parm中填写API地址等信息
|
||||
*/
|
||||
ai_parm: {
|
||||
//[硅基流动](https://siliconflow.cn/) apikey
|
||||
SILICON_FLOW_API_KEY:'',
|
||||
//提示词
|
||||
PROMPT:''
|
||||
//apikey
|
||||
AI_API_KEY: '',
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ async function clear() {
|
||||
/* 延时 */
|
||||
await delay(clear_remove_delay);
|
||||
log.info('清理动态', `第${page + 1}页(${allModifyDynamicResArray.length})中的转发动态与关注全部处理成功`);
|
||||
if (next_offset === '0' || !success) break;
|
||||
if (!next_offset || next_offset === '' || next_offset === '0'|| !success) break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
+75
-11
@@ -127,6 +127,13 @@ class Monitor extends Searcher {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hasEnv('ENABLE_AI_JUDGE') && lottery.drawtime !== -1 && lottery.drawtime < Date.now() / 1000) {
|
||||
log.info('AI过滤', '已过开奖时间');
|
||||
d_storage.updateDyid(lottery.dyid);
|
||||
await delay(filter_wait);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lottery.isOfficialLottery) {
|
||||
let { ts } = await bili.getLotteryNotice(lottery.dyid);
|
||||
const ts_10 = Date.now() / 1000;
|
||||
@@ -250,11 +257,13 @@ class Monitor extends Searcher {
|
||||
* @property {number[]} uid 用户标识
|
||||
* @property {string} dyid 动态标识
|
||||
* @property {boolean} isOfficialLottery 是否官方抽奖
|
||||
* @property {number} drawtime 开奖时间t10
|
||||
* @property {string} relay_chat 转发词
|
||||
* @property {string} ctrl 定位@
|
||||
* @property {string} [rid] 评论标识
|
||||
* @property {number} chat_type 评论类型
|
||||
* @property {string} [chat] 评论词
|
||||
* @property {boolean} [isAiChat] 是否为AI生成的评论
|
||||
*/
|
||||
/**
|
||||
* @returns {Promise<LotteryOptions[]>}
|
||||
@@ -281,7 +290,8 @@ class Monitor extends Searcher {
|
||||
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_ai_comments
|
||||
only_followed, at_users, blockword, blacklist, ai_comments_parm,
|
||||
ai_judge_parm,
|
||||
} = config,
|
||||
now_ts = Date.now() / 1000;
|
||||
|
||||
@@ -354,6 +364,11 @@ class Monitor extends Searcher {
|
||||
|
||||
log.debug('正在筛选的动态信息', lottery_info);
|
||||
|
||||
if (des === '') {
|
||||
log.info('筛选动态', `获取动态内容为空(https://t.bilibili.com/${dyid})风控`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (lottery_info_type.startsWith('sneak') && sneaktower) {
|
||||
log.info('筛选动态', `偷塔模式不检查是否已转发(https://t.bilibili.com/${dyid})`);
|
||||
} else {
|
||||
@@ -378,7 +393,7 @@ class Monitor extends Searcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
const
|
||||
let
|
||||
[m_uid, ori_uid] = uids,
|
||||
mIsFollowed = !m_uid || (new RegExp(m_uid)).test(attentionList),
|
||||
oriIsFollowed = !ori_uid || (new RegExp(ori_uid)).test(attentionList),
|
||||
@@ -399,6 +414,7 @@ class Monitor extends Searcher {
|
||||
isSendChat =
|
||||
(hasOfficialLottery && chatmodel[0] === '1')
|
||||
|| (!hasOfficialLottery && chatmodel[1] === '1'),
|
||||
drawtime = -1,
|
||||
keys = [dyid, m_uid, ori_uid];
|
||||
|
||||
log.debug('筛选动态', { real_uid, mIsFollowed, oriIsFollowed, realIsFollowed, needAt, needTopic, type, isRelayDynamic, key_words, has_key_words, blockword, isBlock, isLottery, isSendChat });
|
||||
@@ -429,7 +445,7 @@ class Monitor extends Searcher {
|
||||
|
||||
if (reserve_id) {
|
||||
if (disable_reserve_lottery) {
|
||||
log.info('已关闭预约抽奖功能');
|
||||
log.info('预约抽奖', '已关闭预约抽奖功能');
|
||||
} else {
|
||||
log.info('预约抽奖', '开始');
|
||||
log.info('预约抽奖', `奖品: ${reserve_lottery_text}`);
|
||||
@@ -446,8 +462,45 @@ class Monitor extends Searcher {
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasOfficialLottery && model[1] === '1' && !has_key_words && description) {
|
||||
log.warn('筛选动态', `无关键词动态的描述: ${description}\n\n考虑是否修改设置key_words:\n${key_words.join('\n且满足: ')}`);
|
||||
if (!hasOfficialLottery && model[1] === '1') {
|
||||
if (hasEnv('ENABLE_AI_JUDGE')) {
|
||||
let msg = await getAiContent(
|
||||
ai_judge_parm.url,
|
||||
ai_judge_parm.body,
|
||||
ai_judge_parm.prompt,
|
||||
lottery_info.des
|
||||
);
|
||||
try {
|
||||
let msg_json = JSON.parse(msg);
|
||||
if (typeof msg_json.has_key_words == 'boolean') {
|
||||
has_key_words = msg_json.has_key_words;
|
||||
isLottery = has_key_words;
|
||||
} else {
|
||||
log.warn('ai判断抽奖', 'no has_key_words');
|
||||
}
|
||||
if (typeof msg_json.needAt == 'boolean') {
|
||||
needAt = msg_json.needAt;
|
||||
} else {
|
||||
log.warn('ai判断抽奖', 'no needAt');
|
||||
}
|
||||
if (typeof msg_json.needTopic == 'string') {
|
||||
needTopic = msg_json.needTopic;
|
||||
} else {
|
||||
log.warn('ai判断抽奖', 'no needTopic');
|
||||
}
|
||||
if (typeof msg_json.drawtime == 'number') {
|
||||
drawtime = msg_json.drawtime;
|
||||
} else {
|
||||
log.warn('ai判断抽奖', 'no drawtime');
|
||||
}
|
||||
log.info('ai判断抽奖', msg_json.more);
|
||||
} catch (_) {
|
||||
log.error('ai判断抽奖', `未返回JSON格式${msg}`);
|
||||
}
|
||||
}
|
||||
if (!has_key_words && description) {
|
||||
log.warn('筛选动态', `无关键词动态的描述: ${description}\n\n考虑是否修改设置key_words或ai提示词`);
|
||||
}
|
||||
}
|
||||
|
||||
/**若勾选只转已关注 */
|
||||
@@ -463,6 +516,8 @@ class Monitor extends Searcher {
|
||||
|
||||
onelotteryinfo.isOfficialLottery = hasOfficialLottery;
|
||||
|
||||
onelotteryinfo.drawtime = drawtime;
|
||||
|
||||
/**初始化待关注列表 */
|
||||
onelotteryinfo.uid = [];
|
||||
|
||||
@@ -527,11 +582,16 @@ class Monitor extends Searcher {
|
||||
/* 是否评论 */
|
||||
if (isSendChat) {
|
||||
onelotteryinfo.rid = rid;
|
||||
if (use_ai_comments) {
|
||||
if (hasEnv('ENABLE_AI_COMMENTS')) {
|
||||
try {
|
||||
log.info('开始获取Ai评论', `(https://t.bilibili.com/${dyid})`);
|
||||
onelotteryinfo.chat = await getAiContent(lottery_info.des) || '!!!';
|
||||
log.info('Ai评论内容', `${onelotteryinfo.chat}`);
|
||||
onelotteryinfo.chat = await getAiContent(
|
||||
ai_comments_parm.url,
|
||||
ai_comments_parm.body,
|
||||
ai_comments_parm.prompt,
|
||||
lottery_info.des) || '!!!';
|
||||
log.info('获取到Ai评论内容', `${onelotteryinfo.chat}`);
|
||||
onelotteryinfo.isAiChat = true;
|
||||
} catch (e) {
|
||||
log.error('获取AI评论失败,使用随机评论', e);
|
||||
onelotteryinfo.chat = (getRandomOne(chats) || '!!!').replace(/\$\{uname\}/g, uname);
|
||||
@@ -591,7 +651,7 @@ class Monitor extends Searcher {
|
||||
|
||||
let
|
||||
status = 0,
|
||||
{ uid, dyid, chat_type, rid, relay_chat, ctrl, chat } = option,
|
||||
{ uid, dyid, chat_type, rid, relay_chat, ctrl, chat, isAiChat } = option,
|
||||
{ check_if_duplicated, is_copy_chat, copy_blockword, is_repost_then_chat, is_not_create_partition } = config;
|
||||
|
||||
/* 评论 */
|
||||
@@ -607,7 +667,11 @@ class Monitor extends Searcher {
|
||||
global_var.get('myUNAME') || '');
|
||||
} else {
|
||||
if (is_repost_then_chat) {
|
||||
chat = chat + relay_chat;
|
||||
if (isAiChat) {
|
||||
relay_chat = chat;
|
||||
} else {
|
||||
chat = chat + relay_chat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,4 +766,4 @@ class Monitor extends Searcher {
|
||||
}
|
||||
|
||||
|
||||
module.exports = { Monitor };
|
||||
module.exports = { Monitor };
|
||||
|
||||
+67
-277
@@ -24,18 +24,18 @@ const { log } = utils;
|
||||
* @property {boolean} is_charge_lottery
|
||||
* @property {boolean} hasOfficialLottery
|
||||
* @property {Array<Object.<string,string|number>>} ctrl
|
||||
* @property {number} origin_create_time 10
|
||||
* @property {number} origin_uid
|
||||
* @property {string} origin_uname
|
||||
* @property {string} origin_rid_str
|
||||
* @property {number} origin_chat_type
|
||||
* @property {string} origin_dynamic_id
|
||||
* @property {number} origin_type
|
||||
* @property {string} origin_description
|
||||
* @property {string} origin_reserve_id
|
||||
* @property {string} origin_reserve_lottery_text
|
||||
* @property {boolean} origin_is_charge_lottery
|
||||
* @property {boolean} origin_hasOfficialLottery
|
||||
* @property {number} origin.create_time 10
|
||||
* @property {number} origin.uid
|
||||
* @property {string} origin.uname
|
||||
* @property {string} origin.rid_str
|
||||
* @property {number} origin.chat_type
|
||||
* @property {string} origin.dynamic_id
|
||||
* @property {number} origin.type
|
||||
* @property {string} origin.description
|
||||
* @property {string} origin.reserve_id
|
||||
* @property {string} origin.reserve_lottery_text
|
||||
* @property {boolean} origin.is_charge_lottery
|
||||
* @property {boolean} origin.hasOfficialLottery
|
||||
*
|
||||
* 整理后的抽奖信息
|
||||
* @typedef {object} LotteryInfo
|
||||
@@ -59,10 +59,6 @@ const { log } = utils;
|
||||
* @return {UsefulDynamicInfo}
|
||||
*/
|
||||
function parseDynamicCard(data) {
|
||||
if (data?.card?.desc?.uid) {
|
||||
return oldParseDynamicCard(data?.card);
|
||||
}
|
||||
|
||||
// 如果是多个 items,返回一个数组
|
||||
if (Array.isArray(data?.items)) {
|
||||
return data.items.map(item => parseDynamicCard({ item }));
|
||||
@@ -96,10 +92,10 @@ function parseDynamicCard(data) {
|
||||
obj.create_time = ditem?.modules?.module_author?.pub_ts || 0;
|
||||
/* 动态类型 */
|
||||
obj.type = dy_typeenum2num.get(ditem?.type) || 0;
|
||||
/* 用于发送评论 */
|
||||
/* 用于发送评论 无法获取到源动态的rid_str*/
|
||||
obj.rid_str = ditem?.basic?.comment_id_str || '';
|
||||
/* 用于发送评论 */
|
||||
obj.chat_type = ditem?.basic?.comment_type || 0;
|
||||
obj.chat_type = dy_type2chat_type.get(ditem?.type) || 0;
|
||||
/* 转发者的动态ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||
obj.dynamic_id = ditem?.id_str || '';
|
||||
/* 定位@信息 */
|
||||
@@ -107,241 +103,40 @@ function parseDynamicCard(data) {
|
||||
/* 是否有官方抽奖 */
|
||||
obj.hasOfficialLottery = false;
|
||||
/* 转发描述 */
|
||||
obj.description = '';
|
||||
obj.description = ditem?.modules?.module_dynamic?.major?.archive?.desc || '';
|
||||
let _total_len = 0;
|
||||
if (Array.isArray(ditem?.modules?.module_dynamic?.desc?.rich_text_nodes)) {
|
||||
ditem?.modules?.module_dynamic?.desc?.rich_text_nodes.forEach(node => {
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_AT') {
|
||||
obj.ctrl.push({
|
||||
data: node.rid,
|
||||
location: _total_len,
|
||||
length: node.text.length,
|
||||
type: 1
|
||||
});
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.hasOfficialLottery = true;
|
||||
}
|
||||
obj.description += node.orig_text;
|
||||
_total_len += node.text.length;
|
||||
});
|
||||
} else {
|
||||
ditem?.modules?.module_dynamic?.major?.opus?.summary?.rich_text_nodes.forEach(node => {
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_AT') {
|
||||
obj.ctrl.push({
|
||||
data: node.rid,
|
||||
location: _total_len,
|
||||
length: node.text.length,
|
||||
type: 1
|
||||
});
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.hasOfficialLottery = true;
|
||||
}
|
||||
obj.description += node.orig_text;
|
||||
_total_len += node.text.length;
|
||||
});
|
||||
}
|
||||
let rich_text_nodes = ditem?.modules?.module_dynamic?.desc?.rich_text_nodes
|
||||
|| ditem?.modules?.module_dynamic?.major?.opus?.summary?.rich_text_nodes
|
||||
|| [];
|
||||
rich_text_nodes.forEach(node => {
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_AT') {
|
||||
obj.ctrl.push({
|
||||
data: node.rid,
|
||||
location: _total_len,
|
||||
length: node.text.length,
|
||||
type: 1
|
||||
});
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.hasOfficialLottery = true;
|
||||
}
|
||||
obj.description += node.orig_text;
|
||||
_total_len += node.text.length;
|
||||
});
|
||||
/* 预约抽奖信息 */
|
||||
obj.reserve_id = ditem?.modules?.module_dynamic?.additional?.reserve?.rid || 0;
|
||||
obj.reserve_lottery_text = ditem?.modules?.module_dynamic?.additional?.reserve?.title || '信息丢失';
|
||||
obj.reserve_lottery_text = ditem?.modules?.module_dynamic?.additional?.reserve?.title || '未获取到';
|
||||
/* 充电抽奖 */
|
||||
obj.is_charge_lottery = false;
|
||||
if (ditem?.modules?.module_dynamic?.additional?.type === 'ADDITIONAL_TYPE_UPOWER_LOTTERY') {
|
||||
obj.is_charge_lottery = true;
|
||||
}
|
||||
/* 转发 */
|
||||
if (obj.type === 1) {
|
||||
/* 被转发者的UID */
|
||||
obj.origin_uid = ditem?.orig?.modules?.module_author?.mid || 0;
|
||||
/* 被转发者的name */
|
||||
obj.origin_uname = ditem?.orig?.modules?.module_author?.name || '';
|
||||
/* 源动态的ts10 */
|
||||
obj.origin_create_time = ditem?.orig?.modules?.module_author?.pub_ts || 0;
|
||||
/* 源动态类型 */
|
||||
obj.origin_type = dy_typeenum2num.get(ditem?.orig?.type) || 0;
|
||||
/* 被转发者的rid(用于发评论) */
|
||||
switch (ditem?.orig?.type) {
|
||||
case 'DYNAMIC_TYPE_DRAW':
|
||||
obj.origin_rid_str = ditem?.orig?.modules?.module_dynamic?.major?.draw?.id?.toString() || '';
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
obj.origin_rid_str = ditem?.orig?.modules?.module_dynamic?.major?.archive?.aid || '';
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
obj.origin_rid_str = ditem?.orig?.modules?.module_dynamic?.major?.article?.id?.toString() || '';
|
||||
break;
|
||||
default:
|
||||
obj.origin_rid_str = ditem?.orig?.id_str || '';
|
||||
break;
|
||||
}
|
||||
/* 用于发送评论 */
|
||||
obj.origin_chat_type = dy_type2chat_type.get(ditem?.orig?.type) || 0;
|
||||
/* 被转发者的动态的ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||
obj.origin_dynamic_id = ditem?.orig?.id_str || '';
|
||||
/* 预约抽奖信息 */
|
||||
obj.origin_reserve_id = ditem?.orig?.modules?.module_dynamic?.additional?.reserve?.rid || 0;
|
||||
obj.origin_reserve_lottery_text = ditem?.orig?.modules?.module_dynamic?.additional?.reserve?.title || '信息丢失';
|
||||
/* 充电抽奖 */
|
||||
if (ditem?.orig?.modules?.module_dynamic?.additional?.type === 'ADDITIONAL_TYPE_UPOWER_LOTTERY') {
|
||||
obj.origin_is_charge_lottery = true;
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
obj.origin_hasOfficialLottery = false;
|
||||
/* 转发描述 */
|
||||
obj.origin_description = '';
|
||||
if (Array.isArray(ditem?.orig?.modules?.module_dynamic?.desc?.rich_text_nodes)) {
|
||||
ditem?.orig?.modules?.module_dynamic?.desc?.rich_text_nodes.forEach(node => {
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.origin_hasOfficialLottery = true;
|
||||
}
|
||||
obj.origin_description += node.orig_text;
|
||||
});
|
||||
} else {
|
||||
ditem?.orig.modules?.module_dynamic?.major?.opus?.summary?.rich_text_nodes.forEach(node => {
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.origin_hasOfficialLottery = true;
|
||||
}
|
||||
obj.origin_description += node.orig_text;
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log.error('动态卡片解析', e);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} dynamic_detail_card
|
||||
* @return {UsefulDynamicInfo}
|
||||
*/
|
||||
function oldParseDynamicCard(dynamic_detail_card) {
|
||||
const { strToJson } = utils;
|
||||
/**临时储存单个动态中的信息 */
|
||||
let obj = {};
|
||||
try {
|
||||
const { desc, card, extension, extend_json = '{}', display = {} } = dynamic_detail_card
|
||||
, { is_liked = 1, user_profile = {} } = desc
|
||||
, { info = {} } = user_profile || {}
|
||||
, cardToJson = strToJson(card)
|
||||
, extendjsonToJson = strToJson(extend_json)
|
||||
, { add_on_card_info = [] } = display || {}
|
||||
, { item } = cardToJson;
|
||||
const dy_type2chat_type = new Map([[1, 17], [2, 11], [4, 17], [8, 1], [64, 12]]);
|
||||
/* 转发者的UID */
|
||||
obj.uid = desc.uid;
|
||||
/* 转发者的name */
|
||||
obj.uname = info.uname || '';
|
||||
/* 动态是否点过赞 */
|
||||
obj.is_liked = is_liked > 0;
|
||||
/* 动态的ts10 */
|
||||
obj.create_time = desc.timestamp;
|
||||
/* 动态类型 */
|
||||
obj.type = desc.type;
|
||||
/* 用于发送评论 */
|
||||
obj.rid_str = desc.rid_str.length > 12 ? desc.dynamic_id_str : desc.rid_str;
|
||||
/* 用于发送评论 */
|
||||
obj.chat_type = dy_type2chat_type.get(obj.type) || 0;
|
||||
/* 转发者的动态ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||
obj.dynamic_id = desc.dynamic_id_str;
|
||||
/* 定位@信息 */
|
||||
obj.ctrl = (extendjsonToJson.ctrl) || [];
|
||||
/* 预约抽奖信息 */
|
||||
if (add_on_card_info.length > 0) {
|
||||
const [status, oid_str, text] = add_on_card_info
|
||||
.filter(it => typeof it.reserve_attach_card !== 'undefined'
|
||||
&& typeof it.reserve_attach_card.reserve_lottery !== 'undefined'
|
||||
&& typeof it.reserve_attach_card.reserve_button !== 'undefined')
|
||||
.map(({ reserve_attach_card }) => [
|
||||
reserve_attach_card.reserve_button.status,
|
||||
reserve_attach_card.oid_str,
|
||||
reserve_attach_card.reserve_lottery.text])[0] || [];
|
||||
if (status === 1) {
|
||||
obj.reserve_id = oid_str;
|
||||
obj.reserve_lottery_text = text;
|
||||
}
|
||||
}
|
||||
if (extendjsonToJson['']) {
|
||||
let r = extendjsonToJson[''].reserve || {};
|
||||
let { reserve_id, reserve_lottery } = r;
|
||||
if (reserve_lottery === 1) {
|
||||
obj.reserve_id = reserve_id + '';
|
||||
obj.reserve_lottery_text = '信息丢失';
|
||||
}
|
||||
}
|
||||
if (extend_json.match(/"":\{"lottery/)) {
|
||||
obj.is_charge_lottery = true;
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
obj.hasOfficialLottery = extension && extension.lott && true;
|
||||
/* 转发者的描述 纯文字内容 图片动态描述 后两个分别是视频动态的描述和视频本身的描述*/
|
||||
obj.description =
|
||||
(item && ((item.content || '') + (item.description || '')))
|
||||
|| (
|
||||
(cardToJson.dynamic || '')
|
||||
+ (cardToJson.desc || '')
|
||||
+ (cardToJson.vest && cardToJson.vest.content || '')
|
||||
)
|
||||
|| '';
|
||||
/* 转发 */
|
||||
if (obj.type === 1) {
|
||||
const { origin_extension, origin, origin_extend_json = '{}' } = cardToJson
|
||||
, originToJson = strToJson(origin)
|
||||
, { add_on_card_info = [] } = display.origin || {}
|
||||
, originExtendjsonToJson = strToJson(origin_extend_json)
|
||||
, { user, item } = originToJson;
|
||||
/* 源动态的ts10 */
|
||||
obj.origin_create_time = desc.origin.timestamp;
|
||||
/* 被转发者的UID */
|
||||
obj.origin_uid = desc.origin.uid;
|
||||
/* 源动态类型 */
|
||||
obj.origin_type = desc.orig_type;
|
||||
/* 被转发者的rid(用于发评论) */
|
||||
obj.origin_rid_str = desc.origin.rid_str.length > 12 ? desc.origin.dynamic_id_str : desc.origin.rid_str;
|
||||
/* 用于发送评论 */
|
||||
obj.origin_chat_type = dy_type2chat_type.get(obj.origin_type) || 0;
|
||||
/* 被转发者的动态的ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||
obj.origin_dynamic_id = desc.orig_dy_id_str;
|
||||
/* 预约抽奖信息 */
|
||||
if (add_on_card_info.length > 0) {
|
||||
const [status, oid_str, text] = add_on_card_info
|
||||
.filter(it => typeof it.reserve_attach_card !== 'undefined'
|
||||
&& typeof it.reserve_attach_card.reserve_lottery !== 'undefined'
|
||||
&& typeof it.reserve_attach_card.reserve_button !== 'undefined')
|
||||
.map(({ reserve_attach_card }) => [
|
||||
reserve_attach_card.reserve_button.status,
|
||||
reserve_attach_card.oid_str,
|
||||
reserve_attach_card.reserve_lottery.text])[0] || [];
|
||||
if (status === 1) {
|
||||
obj.origin_reserve_id = oid_str;
|
||||
obj.origin_reserve_lottery_text = text;
|
||||
}
|
||||
}
|
||||
if (originExtendjsonToJson['']) {
|
||||
let r = originExtendjsonToJson[''].reserve || {};
|
||||
let { reserve_id, reserve_lottery } = r;
|
||||
if (reserve_lottery === 1) {
|
||||
obj.origin_reserve_id = reserve_id + '';
|
||||
obj.origin_reserve_lottery_text = '信息丢失';
|
||||
}
|
||||
}
|
||||
if (origin_extend_json.match(/"":\{"lottery/)) {
|
||||
obj.origin_is_charge_lottery = true;
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
obj.origin_hasOfficialLottery = origin_extension && origin_extension.lott;
|
||||
/* 被转发者的name */
|
||||
obj.origin_uname = (user && (user.name || user.uname)) || '';
|
||||
/* 被转发者的描述 */
|
||||
obj.origin_description =
|
||||
(item && (item.content || '' + item.description || ''))
|
||||
|| (originToJson.dynamic || '' + originToJson.desc || '')
|
||||
|| '';
|
||||
obj.origin = parseDynamicCard({item: ditem.orig});
|
||||
} else {
|
||||
obj.origin = {};
|
||||
}
|
||||
} catch (e) {
|
||||
log.error('动态卡片解析', e);
|
||||
@@ -364,9 +159,9 @@ function modifyDynamicRes(res) {
|
||||
log.error('处理动态数据', '获取动态数据出错,可能是访问太频繁 \n' + res);
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* !cards已经能涵盖cards == null,你在想什么?
|
||||
*/
|
||||
/**
|
||||
* !cards已经能涵盖cards == null,你在想什么?
|
||||
*/
|
||||
if (!items || !items.length) {
|
||||
log.warn('处理动态数据', '未找到任何动态信息');
|
||||
items = [];
|
||||
@@ -438,8 +233,8 @@ class Searcher {
|
||||
|
||||
// 当 offset 为 '0'(初始页)时,传入 offset 会报错
|
||||
const OneDynamicInfo = offset === '0'
|
||||
? await hadUidGetOneDynamicInfoByUID()
|
||||
: await hadUidGetOneDynamicInfoByUID(offset);
|
||||
? await hadUidGetOneDynamicInfoByUID()
|
||||
: await hadUidGetOneDynamicInfoByUID(offset);
|
||||
|
||||
const mDRdata = modifyDynamicRes(OneDynamicInfo);
|
||||
|
||||
@@ -499,36 +294,31 @@ class Searcher {
|
||||
}
|
||||
})
|
||||
.reduce(async (pre, cur) => {
|
||||
let
|
||||
results = await pre,
|
||||
{ origin_dynamic_id } = cur,
|
||||
is_liked = false;
|
||||
let results = await pre;
|
||||
|
||||
if (!check_if_duplicated || check_if_duplicated >= 2) {
|
||||
const card = await bili.getOneDynamicByDyid(origin_dynamic_id);
|
||||
log.info('获取动态', `查看源动态(${origin_dynamic_id})是否点赞 (${length--})`);
|
||||
if (card) {
|
||||
({ is_liked } = parseDynamicCard(card));
|
||||
}
|
||||
await utils.delay(get_dynamic_detail_wait);
|
||||
const card = await bili.getOneDynamicByDyid(cur.origin.dynamic_id);
|
||||
log.info('获取动态', `查看源动态(${cur.origin.dynamic_id})详细信息获取rid用于评论 (${length--})`);
|
||||
if (card) {
|
||||
cur.origin = parseDynamicCard(card);
|
||||
}
|
||||
await utils.delay(get_dynamic_detail_wait);
|
||||
|
||||
results.push({
|
||||
lottery_info_type: 'uid',
|
||||
create_time: cur.origin_create_time,
|
||||
is_liked,
|
||||
uids: [cur.uid, cur.origin_uid],
|
||||
uname: cur.origin_uname,
|
||||
ctrl: [],
|
||||
dyid: cur.origin_dynamic_id,
|
||||
reserve_id: cur.origin_reserve_id,
|
||||
reserve_lottery_text: cur.origin_reserve_lottery_text,
|
||||
is_charge_lottery: cur.origin_is_charge_lottery,
|
||||
rid: cur.origin_rid_str,
|
||||
chat_type: cur.origin_chat_type,
|
||||
des: cur.origin_description,
|
||||
type: cur.origin_type,
|
||||
hasOfficialLottery: cur.origin_hasOfficialLottery
|
||||
create_time: cur.origin.create_time,
|
||||
is_liked: cur.origin.is_liked,
|
||||
uids: [cur.uid, cur.origin.uid],
|
||||
uname: cur.origin.uname,
|
||||
ctrl: cur.origin.ctrl,
|
||||
dyid: cur.origin.dynamic_id,
|
||||
reserve_id: cur.origin.reserve_id,
|
||||
reserve_lottery_text: cur.origin.reserve_lottery_text,
|
||||
is_charge_lottery: cur.origin.is_charge_lottery,
|
||||
rid: cur.origin.rid_str,
|
||||
chat_type: cur.origin.chat_type,
|
||||
des: cur.origin.description,
|
||||
type: cur.origin.type,
|
||||
hasOfficialLottery: cur.origin.hasOfficialLottery
|
||||
});
|
||||
|
||||
return results;
|
||||
@@ -581,7 +371,7 @@ class Searcher {
|
||||
lottery_info_type: 'tag',
|
||||
create_time: o.create_time,
|
||||
is_liked: o.is_liked,
|
||||
uids: [o.uid, o.origin_uid],
|
||||
uids: [o.uid, o.origin.uid],
|
||||
uname: o.uname,
|
||||
ctrl: o.ctrl,
|
||||
dyid: o.dynamic_id,
|
||||
@@ -674,7 +464,7 @@ class Searcher {
|
||||
lottery_info_type: 'article',
|
||||
create_time: o.create_time,
|
||||
is_liked: o.is_liked,
|
||||
uids: [o.uid, o.origin_uid],
|
||||
uids: [o.uid, o.origin.uid],
|
||||
uname: o.uname,
|
||||
ctrl: o.ctrl,
|
||||
dyid: o.dynamic_id,
|
||||
@@ -815,7 +605,7 @@ class Searcher {
|
||||
lottery_info_type: 'txt',
|
||||
create_time: o.create_time,
|
||||
is_liked: o.is_liked,
|
||||
uids: [o.uid, o.origin_uid],
|
||||
uids: [o.uid, o.origin.uid],
|
||||
uname: o.uname,
|
||||
ctrl: o.ctrl,
|
||||
dyid: o.dynamic_id,
|
||||
|
||||
+13
-1
@@ -86,6 +86,12 @@ const config = {
|
||||
'[转关评粉]|参与'
|
||||
],
|
||||
|
||||
ai_judge_parm: {
|
||||
url: '',
|
||||
body: {},
|
||||
prompt: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* - '00' 关闭自动抽奖
|
||||
* - '10' 只转发官方抽奖
|
||||
@@ -332,6 +338,12 @@ const config = {
|
||||
'坚持不懈,迎难而上,开拓创新!', '[OK][OK]', '我来抽个奖', '中中中中中中', '[doge][doge][doge]', '我我我',
|
||||
],
|
||||
|
||||
ai_comments_parm: {
|
||||
url: '',
|
||||
body: {},
|
||||
prompt: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* 是否抄热评
|
||||
*/
|
||||
@@ -478,4 +490,4 @@ const config = {
|
||||
};
|
||||
|
||||
|
||||
module.exports = config;
|
||||
module.exports = config;
|
||||
|
||||
+89
-5
@@ -70,6 +70,7 @@ let PUSH_PLUS_TOKEN = '';
|
||||
let PUSH_PLUS_USER = '';
|
||||
|
||||
// ===========================================QMSG===========================================
|
||||
let QMSG_SOCKET = '';
|
||||
let QMSG_KEY = '';
|
||||
let QMSG_QQ = '';
|
||||
|
||||
@@ -87,6 +88,14 @@ let GOTIFY_URL = '';
|
||||
// 此处填你想推送的Application的Token(不包含推送时额外添加的前缀 Bearer )
|
||||
let GOTIFY_APPKEY = '';
|
||||
|
||||
// =======================================飞书机器人通知设置区域===========================================
|
||||
// 此处填你飞书机器人的 webhook(详见文档 https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot)
|
||||
// 注:此处设置github action用户填写到Settings-Secrets里面(Name输入FS_BOT_WEBHOOK)
|
||||
let FS_BOT_WEBHOOK = '';
|
||||
// 签名密钥(如果在飞书机器人安全设置里开启了“签名校验”)
|
||||
// 注:此处设置github action用户填写到Settings-Secrets里面(Name输入FS_BOT_SECRET)
|
||||
let FS_BOT_SECRET = '';
|
||||
|
||||
//==========================云端环境变量的判断与接收=========================
|
||||
if (process.env.SCKEY) {
|
||||
SCKEY = process.env.SCKEY;
|
||||
@@ -173,6 +182,12 @@ if (process.env.PUSH_PLUS_USER) {
|
||||
PUSH_PLUS_USER = process.env.PUSH_PLUS_USER;
|
||||
}
|
||||
|
||||
if (process.env.QMSG_SOCKET) {
|
||||
QMSG_SOCKET = process.env.QMSG_SOCKET;
|
||||
} else {
|
||||
QMSG_SOCKET = 'qmsg.zendee.cn';
|
||||
}
|
||||
|
||||
if (process.env.QMSG_KEY) {
|
||||
QMSG_KEY = process.env.QMSG_KEY;
|
||||
}
|
||||
@@ -204,6 +219,14 @@ if (process.env.GOTIFY_URL) {
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.FS_BOT_WEBHOOK) {
|
||||
FS_BOT_WEBHOOK = process.env.FS_BOT_WEBHOOK;
|
||||
}
|
||||
|
||||
if (process.env.FS_BOT_SECRET) {
|
||||
FS_BOT_SECRET = process.env.FS_BOT_SECRET;
|
||||
}
|
||||
|
||||
//==========================云端环境变量的判断与接收=========================
|
||||
|
||||
async function sendNotify(text, desp, params = {}) {
|
||||
@@ -239,7 +262,9 @@ async function sendNotify(text, desp, params = {}) {
|
||||
//电子邮件
|
||||
email(text, desp),
|
||||
// Gotify
|
||||
gotifyNotify(text, desp)
|
||||
gotifyNotify(text, desp),
|
||||
// 飞书机器人
|
||||
feishuNotify(text, desp)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -619,7 +644,7 @@ function ddBotNotify(text, desp) {
|
||||
|
||||
function qywxAmNotify(text, desp) {
|
||||
return new Promise(resolve => {
|
||||
desp=desp.replace(/\n/g, '<br>');
|
||||
desp = desp.replace(/\n/g, '<br>');
|
||||
if (QYWX_AM) {
|
||||
const QYWX_AM_AY = QYWX_AM.split(',');
|
||||
send({
|
||||
@@ -648,8 +673,8 @@ function qywxAmNotify(text, desp) {
|
||||
agentid: `${QYWX_AM_AY[3]}`,
|
||||
safe: '0',
|
||||
msgtype: 'mpnews',
|
||||
mpnews : {
|
||||
articles:[
|
||||
mpnews: {
|
||||
articles: [
|
||||
{
|
||||
title: `${text}`,
|
||||
thumb_media_id: `${QYWX_AM_AY[4]}`,
|
||||
@@ -878,12 +903,71 @@ function gotifyNotify(text, desp) {
|
||||
});
|
||||
}
|
||||
|
||||
function feishuNotify(text, desp) {
|
||||
return new Promise(resolve => {
|
||||
if (FS_BOT_WEBHOOK) {
|
||||
const payload = {
|
||||
msg_type: 'text',
|
||||
content: {
|
||||
text: `${text}\n\n${desp}`
|
||||
}
|
||||
};
|
||||
|
||||
if (FS_BOT_SECRET) {
|
||||
const crypto = require('crypto');
|
||||
const timestamp = Math.floor(Date.now() / 1000);
|
||||
const signStr = `${timestamp}\n${FS_BOT_SECRET}`;
|
||||
const sign = crypto
|
||||
.createHmac('sha256', FS_BOT_SECRET)
|
||||
.update(signStr)
|
||||
.digest('base64');
|
||||
payload.timestamp = `${timestamp}`;
|
||||
payload.sign = sign;
|
||||
}
|
||||
|
||||
send({
|
||||
method: 'POST',
|
||||
url: FS_BOT_WEBHOOK,
|
||||
contents: payload,
|
||||
config: {
|
||||
retry: false
|
||||
},
|
||||
headers: {
|
||||
accept: 'application/json, text/plain, */*',
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
success: res => {
|
||||
try {
|
||||
const data = JSON.parse(res.body);
|
||||
if (data.code === 0) {
|
||||
log.info('发送通知', '飞书机器人发送通知消息完成。');
|
||||
} else {
|
||||
log.error('发送通知', `${data.msg || '飞书机器人发送通知异常'}`);
|
||||
}
|
||||
} catch (e) {
|
||||
log.error('发送通知', e);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
failure: err => {
|
||||
log.error('发送通知', '飞书机器人发送通知消息失败!!' + err);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
log.debug('发送通知', '您未提供飞书机器人推送所需的FS_BOT_WEBHOOK,取消飞书机器人推送消息通知');
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function qmsg(text, desp) {
|
||||
return new Promise(resolve => {
|
||||
if (QMSG_KEY) {
|
||||
send({
|
||||
method: 'POST',
|
||||
url: 'https://qmsg.zendee.cn/send/' + QMSG_KEY,
|
||||
url: `https://${QMSG_SOCKET}/send/${QMSG_KEY}`,
|
||||
contents: {
|
||||
msg: text + '\n\n' + desp,
|
||||
qq: QMSG_QQ
|
||||
|
||||
@@ -5,7 +5,6 @@ module.exports = Object.freeze({
|
||||
DYNAMIC_REPOST_SHARE: 'https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/share',
|
||||
DYNAMIC_SVR_CREATE_DRAW: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create_draw',
|
||||
DYNAMIC_SVR_CREATE: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_RM_DYNAMIC: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/rm_dynamic',
|
||||
FEED_GET_ATTENTION_LIST: 'https://api.vc.bilibili.com/feed/v1/feed/get_attention_list',
|
||||
FEED_SETUSERFOLLOW: 'https://api.vc.bilibili.com/feed/v1/feed/SetUserFollow',
|
||||
|
||||
+5
-11
@@ -98,8 +98,8 @@ function get({ url, config, contents, query }) {
|
||||
},
|
||||
query,
|
||||
contents,
|
||||
success: res => resolve(res.body),
|
||||
failure: err => resolve(err)
|
||||
success: res => resolve(log.debug_return(url, res.body)),
|
||||
failure: err => resolve(log.debug_return(url, err))
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -122,8 +122,8 @@ function post({ url, config, contents, query }) {
|
||||
},
|
||||
query,
|
||||
contents,
|
||||
success: res => resolve(res.body),
|
||||
failure: err => resolve(err)
|
||||
success: res => resolve(log.debug_return(url, res.body)),
|
||||
failure: err => resolve(log.debug_return(url, err))
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -423,13 +423,6 @@ const bili_client = {
|
||||
features: 'itemOpusStyle'
|
||||
}
|
||||
}),
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL,
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
}),
|
||||
]
|
||||
, responseText => {
|
||||
const
|
||||
@@ -464,6 +457,7 @@ const bili_client = {
|
||||
query: {
|
||||
host_mid,
|
||||
offset,
|
||||
features: 'itemOpusStyle'
|
||||
},
|
||||
config: {
|
||||
retry: false
|
||||
|
||||
+27
-21
@@ -242,6 +242,10 @@ const utils = {
|
||||
this.proPrint(color_text_pair.map(([color, text]) => color(text)));
|
||||
}
|
||||
},
|
||||
debug_return(context, obj) {
|
||||
this.debug(context, obj);
|
||||
return obj;
|
||||
},
|
||||
info(context, msg) {
|
||||
if (this._level >= 3) {
|
||||
let color_text_pair = [
|
||||
@@ -510,41 +514,43 @@ const utils = {
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取ai评论
|
||||
* 获取ai
|
||||
* @param {string} url
|
||||
* @param {object} body
|
||||
* @param {string} prompt
|
||||
* @param {string} content
|
||||
* @returns {Promise<string|null>}
|
||||
*/
|
||||
getAiContent(content) {
|
||||
getAiContent(url, body, prompt, content) {
|
||||
return new Promise((resolve) => {
|
||||
send({
|
||||
method: 'POST',
|
||||
url: 'https://api.siliconflow.cn/v1/chat/completions',
|
||||
url,
|
||||
headers: {
|
||||
'authorization': 'Bearer ' + process.env.SILICON_FLOW_API_KEY,
|
||||
'authorization': 'Bearer ' + process.env.AI_API_KEY,
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
config: {
|
||||
timeout: 120000
|
||||
},
|
||||
contents: {
|
||||
model: 'Qwen/Qwen3-32B',
|
||||
...body,
|
||||
'stream': false,
|
||||
'max_tokens': 512,
|
||||
'enable_thinking': true,
|
||||
'thinking_budget': 4096,
|
||||
'min_p': 0.05,
|
||||
'temperature': 0.7,
|
||||
'top_p': 0.7,
|
||||
'top_k': 50,
|
||||
'frequency_penalty': 0.5,
|
||||
'n': 1,
|
||||
'stop': [],
|
||||
'response_format': { 'type': 'text' },
|
||||
'messages': [{
|
||||
'role': 'system',
|
||||
'content': process.env.PROMPT
|
||||
}, { 'role': 'user', 'content': content }]
|
||||
'messages': [
|
||||
{
|
||||
'role': 'system',
|
||||
'content': prompt
|
||||
},
|
||||
{
|
||||
'role': 'user',
|
||||
'content': content
|
||||
}
|
||||
]
|
||||
},
|
||||
success: res => {
|
||||
const data = utils.strToJson(res.body);
|
||||
resolve(data?.choices?.[0]?.message?.content || null);
|
||||
resolve(utils.log.debug_return(content, data?.choices?.[0]?.message?.content) || null);
|
||||
},
|
||||
failure: () => {
|
||||
resolve(null);
|
||||
@@ -555,4 +561,4 @@ const utils = {
|
||||
};
|
||||
|
||||
|
||||
module.exports = utils;
|
||||
module.exports = utils;
|
||||
|
||||
+50
-13
@@ -90,6 +90,19 @@ module.exports = Object.freeze({
|
||||
'[转关评粉]|参与'
|
||||
],
|
||||
|
||||
/**
|
||||
* AI 判断抽奖
|
||||
* https://learn.microsoft.com/en-us/azure/ai-foundry/openai/reference#chat-completions
|
||||
*/
|
||||
ai_judge_parm: {
|
||||
/**
|
||||
* /chat/completions
|
||||
*/
|
||||
url: '',
|
||||
body: {},
|
||||
prompt: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* - '00' 关闭自动抽奖
|
||||
* - '10' 只转发官方抽奖
|
||||
@@ -341,6 +354,19 @@ module.exports = Object.freeze({
|
||||
'坚持不懈,迎难而上,开拓创新!', '[OK][OK]', '我来抽个奖', '中中中中中中', '[doge][doge][doge]', '我我我',
|
||||
],
|
||||
|
||||
/**
|
||||
* AI Chat completions参数
|
||||
* https://learn.microsoft.com/en-us/azure/ai-foundry/openai/reference#chat-completions
|
||||
*/
|
||||
ai_comments_parm: {
|
||||
/**
|
||||
* /chat/completions
|
||||
*/
|
||||
url: '',
|
||||
body: {},
|
||||
prompt: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* 是否抄热评
|
||||
*/
|
||||
@@ -460,13 +486,6 @@ module.exports = Object.freeze({
|
||||
* [1,2,4]
|
||||
*/
|
||||
clear_dynamic_type: [1],
|
||||
/**
|
||||
* 是否使用ai评论。
|
||||
* true:使用
|
||||
* false:不使用
|
||||
* 如需使用需要再env.js配置ai_parm
|
||||
*/
|
||||
use_ai_comments: false
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -477,15 +496,12 @@ module.exports = Object.freeze({
|
||||
/**
|
||||
* 手动添加抽奖号UID
|
||||
* - 抽奖动态下的二级小号
|
||||
*
|
||||
* 帐号1存储抽奖信息至文件
|
||||
*/
|
||||
UIDs: [],
|
||||
|
||||
TAGs: [
|
||||
'互动抽奖',
|
||||
'转发抽奖',
|
||||
'动态抽奖',
|
||||
'抽奖',
|
||||
],
|
||||
TAGs: [],
|
||||
|
||||
Articles: [
|
||||
'抽奖合集'
|
||||
@@ -493,8 +509,29 @@ module.exports = Object.freeze({
|
||||
|
||||
APIs: [],
|
||||
|
||||
ai_judge_parm: {
|
||||
url: 'https://api.deepseek.com/chat/completions',
|
||||
body: {
|
||||
'model': 'Qwen/Qwen3-32B',
|
||||
'enable_thinking': true,
|
||||
},
|
||||
prompt: '你是一个B站用户,需要判断动态内容是否是抽奖动态,以及参与条件,以json格式输出,仅需包含key:has_key_words(bool 是否是抽奖动态),needAt(bool 参与抽奖是否需要@自己的好友),needTopic(string 参与抽奖需要带的话题,返回话题需要用#号括起来),drawtime(number 开奖时间的10位数时间戳未获取到返回-1),more(string 总结参与抽奖的条件).回答不要包含markdown标记文本,输出纯json文本'
|
||||
},
|
||||
|
||||
ai_comments_parm: {
|
||||
url: 'https://api.deepseek.com/chat/completions',
|
||||
body: {
|
||||
'model': 'Qwen/Qwen3-32B',
|
||||
'enable_thinking': true,
|
||||
},
|
||||
prompt: '你是一个B站用户,请根据以下内容直接生成一条模拟真实用户的评论,不要使用表情,无需说明信息,且不包含任何敏感词汇。'
|
||||
},
|
||||
|
||||
save_lottery_info_to_file: true,
|
||||
},
|
||||
/**
|
||||
* 后续帐号从文件提取抽奖信息转抽
|
||||
*/
|
||||
config_2: {},
|
||||
config_3: {}
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lottery-auto-script",
|
||||
"version": "2.10.0",
|
||||
"version": "2.11.2",
|
||||
"description": "自动参与B站动态抽奖",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
+15
-15
@@ -1,32 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# version: <major.minor.patch>
|
||||
level=minor
|
||||
level=patch
|
||||
|
||||
npm version $level \
|
||||
--no-commit-hooks \
|
||||
--no-git-tag-version
|
||||
|
||||
OLD_VERSION_ARRAY=($(npm view lottery-auto-script version | tr '.' ' '))
|
||||
OLD_VERSION_ARRAY=($(npm pkg get version | tr -d '"' | tr '.' ' '))
|
||||
major=${OLD_VERSION_ARRAY[0]}
|
||||
minor=${OLD_VERSION_ARRAY[1]}
|
||||
patch=${OLD_VERSION_ARRAY[2]}
|
||||
|
||||
case "${level}" in
|
||||
"major")
|
||||
((major += 1))
|
||||
minor=0
|
||||
patch=0
|
||||
;;
|
||||
((major += 1))
|
||||
minor=0
|
||||
patch=0
|
||||
;;
|
||||
"minor")
|
||||
((minor += 1))
|
||||
patch=0
|
||||
;;
|
||||
((minor += 1))
|
||||
patch=0
|
||||
;;
|
||||
*)
|
||||
((patch += 1))
|
||||
;;
|
||||
((patch += 1))
|
||||
;;
|
||||
esac
|
||||
|
||||
npm version $level \
|
||||
--no-commit-hooks \
|
||||
--no-git-tag-version
|
||||
|
||||
NEW_VERSION="$major.$minor.$patch"
|
||||
|
||||
echo "New Version: $NEW_VERSION"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
const util = require('./util');
|
||||
const utils = require('../lib/utils.js');
|
||||
const config = require('../lib/data/config');
|
||||
|
||||
(async () => {
|
||||
await util.par_run([], [
|
||||
// 0
|
||||
async () => {
|
||||
let msg = await utils.getAiContent(
|
||||
config.ai_judge_parm.url,
|
||||
config.ai_judge_parm.body,
|
||||
config.ai_judge_parm.prompt,
|
||||
'#胜利女神新的希望# #nikke# \n【一周年评论盖楼挑战③】拿来吧妮……的表情包!\n\n指挥官的手机里,\n一定存着几张出场率超高的妮姬表情包吧?\n和妮姬们相遇的一周年已至,这些也成了旅途中的一段快乐印记~是时候公开自己的库存了yo!\n\n无论是新收新做的趣味表情,还是珍藏一年的经典老图——\n现在,让它们登场吧!\n\n评论区交出您的表情包库存,看看这一年谁的“收藏”最cool!!\n🎁我们将在6月9日于本条评论区随机抽选:\n▶1位指挥官赠送【周边大礼盒】× 1\n▶10位指挥官赠送【Q版印章小立牌】× 1\n\n💝盖楼目标达成奖励:\n5月20日~22日期间,参与【一周年评论盖楼挑战】系列话题活动! 当全平台评论数累计达成 【2026】 楼时,我们将从本平台参与系列话题活动的用户中额外抽取2位幸运指挥官,每人送出【哈曼卡顿音响】× 1!\n\n————————————\n✦《胜利女神:新的希望》一周年庆典版本「OLD TALES 尘封童话」现已上线!游戏多端互通,前往Bilibili游戏中心搜索《胜利女神:新的希望》即可下载。'
|
||||
);
|
||||
console.log(JSON.parse(msg));
|
||||
msg = await utils.getAiContent(
|
||||
config.ai_comments_parm.url,
|
||||
config.ai_comments_parm.body,
|
||||
config.ai_comments_parm.prompt,
|
||||
'#胜利女神新的希望# #nikke# \n【一周年评论盖楼挑战③】拿来吧妮……的表情包!\n\n指挥官的手机里,\n一定存着几张出场率超高的妮姬表情包吧?\n和妮姬们相遇的一周年已至,这些也成了旅途中的一段快乐印记~是时候公开自己的库存了yo!\n\n无论是新收新做的趣味表情,还是珍藏一年的经典老图——\n现在,让它们登场吧!\n\n评论区交出您的表情包库存,看看这一年谁的“收藏”最cool!!\n🎁我们将在6月9日于本条评论区随机抽选:\n▶1位指挥官赠送【周边大礼盒】× 1\n▶10位指挥官赠送【Q版印章小立牌】× 1\n\n💝盖楼目标达成奖励:\n5月20日~22日期间,参与【一周年评论盖楼挑战】系列话题活动! 当全平台评论数累计达成 【2026】 楼时,我们将从本平台参与系列话题活动的用户中额外抽取2位幸运指挥官,每人送出【哈曼卡顿音响】× 1!\n\n————————————\n✦《胜利女神:新的希望》一周年庆典版本「OLD TALES 尘封童话」现已上线!游戏多端互通,前往Bilibili游戏中心搜索《胜利女神:新的希望》即可下载。'
|
||||
);
|
||||
console.log(msg);
|
||||
msg = await utils.getAiContent(
|
||||
config.ai_judge_parm.url,
|
||||
config.ai_judge_parm.body,
|
||||
config.ai_judge_parm.prompt,
|
||||
'#全民掉线行动#今日启动!参与活动,领GT7、X1心动优惠 2022年助你去线去烦恼,乐享焕新声活!活动规则见下图。 #供电局福利社# #互动抽奖##抽奖# 【关注】@Haylou嘿喽 ,带话题#全民掉线行动#,【转发+评论+赞】本动态,小嘿将随机抽4个欧皇送出以下福利: 一等奖:Haylou X1 双降噪蓝牙耳机 1台 二等奖:Haylou GT7 真无线蓝牙耳机1台 三等奖:50元京东卡*2 并且小嘿特意又申请了意外惊喜,加码福利送上,大家冲鸭: 截至抽奖结束: 【转发超1w】,再抽一位小可爱送50元京东卡*1 【粉丝超1.5w】,再抽一位小可爱送Haylou T17运动蓝牙耳机*1台 开奖时间1月27日,中奖名单将通过第三方抽奖工具选出。冲冲冲! *一定要时刻关注@Haylou嘿喽 哦!开奖后的3天内,未回复小嘿私信领奖的粉丝按照自动弃奖处理哦! '
|
||||
);
|
||||
console.log(JSON.parse(msg));
|
||||
msg = await utils.getAiContent(
|
||||
config.ai_comments_parm.url,
|
||||
config.ai_comments_parm.body,
|
||||
config.ai_comments_parm.prompt,
|
||||
'#全民掉线行动#今日启动!参与活动,领GT7、X1心动优惠 2022年助你去线去烦恼,乐享焕新声活!活动规则见下图。 #供电局福利社# #互动抽奖##抽奖# 【关注】@Haylou嘿喽 ,带话题#全民掉线行动#,【转发+评论+赞】本动态,小嘿将随机抽4个欧皇送出以下福利: 一等奖:Haylou X1 双降噪蓝牙耳机 1台 二等奖:Haylou GT7 真无线蓝牙耳机1台 三等奖:50元京东卡*2 并且小嘿特意又申请了意外惊喜,加码福利送上,大家冲鸭: 截至抽奖结束: 【转发超1w】,再抽一位小可爱送50元京东卡*1 【粉丝超1.5w】,再抽一位小可爱送Haylou T17运动蓝牙耳机*1台 开奖时间1月27日,中奖名单将通过第三方抽奖工具选出。冲冲冲! *一定要时刻关注@Haylou嘿喽 哦!开奖后的3天内,未回复小嘿私信领奖的粉丝按照自动弃奖处理哦! '
|
||||
);
|
||||
console.log(msg);
|
||||
msg = await utils.getAiContent(
|
||||
config.ai_judge_parm.url,
|
||||
config.ai_judge_parm.body,
|
||||
config.ai_judge_parm.prompt,
|
||||
'#全民掉线行动#今日启动!参与活动,领GT7、X1心动优惠 2022年助你去线去烦恼,乐享焕新声活!活动规则见下图。 #供电局福利社# #互动抽奖##抽奖# 【关注】@Haylou嘿喽 ,带话题#全民掉线行动#,【转发+评论+赞】本动态,小嘿将随机抽4个欧皇送出以下福利: 一等奖:Haylou X1 双降噪蓝牙耳机 1台 二等奖:Haylou GT7 真无线蓝牙耳机1台 三等奖:50元京东卡*2 并且小嘿特意又申请了意外惊喜,加码福利送上,大家冲鸭: 截至抽奖结束: 【转发超1w】,再抽一位小可爱送50元京东卡*1 【粉丝超1.5w】,再抽一位小可爱送Haylou T17运动蓝牙耳机*1台,中奖名单将通过第三方抽奖工具选出。冲冲冲! *一定要时刻关注@Haylou嘿喽 哦!开奖后的3天内,未回复小嘿私信领奖的粉丝按照自动弃奖处理哦! '
|
||||
);
|
||||
console.log(JSON.parse(msg));
|
||||
msg = await utils.getAiContent(
|
||||
config.ai_comments_parm.url,
|
||||
config.ai_comments_parm.body,
|
||||
config.ai_comments_parm.prompt,
|
||||
'#全民掉线行动#今日启动!参与活动,领GT7、X1心动优惠 2022年助你去线去烦恼,乐享焕新声活!活动规则见下图。 #供电局福利社# #互动抽奖##抽奖# 【关注】@Haylou嘿喽 ,带话题#全民掉线行动#,【转发+评论+赞】本动态,小嘿将随机抽4个欧皇送出以下福利: 一等奖:Haylou X1 双降噪蓝牙耳机 1台 二等奖:Haylou GT7 真无线蓝牙耳机1台 三等奖:50元京东卡*2 并且小嘿特意又申请了意外惊喜,加码福利送上,大家冲鸭: 截至抽奖结束: 【转发超1w】,再抽一位小可爱送50元京东卡*1 【粉丝超1.5w】,再抽一位小可爱送Haylou T17运动蓝牙耳机*1台 开奖时间1月27日,中奖名单将通过第三方抽奖工具选出。冲冲冲! *一定要时刻关注@Haylou嘿喽 哦!开奖后的3天内,未回复小嘿私信领奖的粉丝按照自动弃奖处理哦! '
|
||||
);
|
||||
console.log(msg);
|
||||
},
|
||||
]);
|
||||
console.log('ai.test ... ok!');
|
||||
})();
|
||||
@@ -3,7 +3,7 @@ const util = require('./util');
|
||||
const d_storage = require('../lib/helper/d_storage');
|
||||
|
||||
(async () => {
|
||||
await util.par_run([0], [
|
||||
await util.par_run([], [
|
||||
// 0
|
||||
async () => {
|
||||
assert(await d_storage.searchDyid('1234567901234568'));
|
||||
|
||||
+16
-51
@@ -1,68 +1,33 @@
|
||||
const assert = require('assert');
|
||||
//const assert = require('assert');
|
||||
const bili_client = require('../lib/net/bili');
|
||||
const searcher = require('../lib/core/searcher');
|
||||
const util = require('./util');
|
||||
|
||||
(async () => {
|
||||
await util.par_run([], [
|
||||
await util.par_run([0, 1, 2, 3], [
|
||||
// 0
|
||||
async () => {
|
||||
let info = await bili_client.getOneDynamicByDyid('728424890210713624');
|
||||
assert(searcher.parseDynamicCard(info).is_charge_lottery);
|
||||
let info = await bili_client.getOneDynamicByDyid('1206954551173709840');
|
||||
let card = searcher.parseDynamicCard(info);
|
||||
console.log(JSON.stringify(card, null, 4));
|
||||
},
|
||||
// 1
|
||||
async () => {
|
||||
let info = await bili_client.getOneDynamicByDyid('768874900850999300');
|
||||
assert(searcher.parseDynamicCard(info).origin_is_charge_lottery);
|
||||
let info = await bili_client.getOneDynamicByDyid('1207028214165143570');
|
||||
let card = searcher.parseDynamicCard(info);
|
||||
console.log(JSON.stringify(card, null, 4));
|
||||
},
|
||||
// 2
|
||||
async () => {
|
||||
let card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid('746824225190314008'));
|
||||
let chats = await bili_client.getChat(card.rid_str, card.chat_type);
|
||||
assert(chats.length > 0 && typeof chats[0][0] == 'string');
|
||||
let info = await bili_client.getOneDynamicByDyid('1209643548566093825');
|
||||
let card = searcher.parseDynamicCard(info);
|
||||
console.log(JSON.stringify(card, null, 4));
|
||||
},
|
||||
// 3
|
||||
async () => {
|
||||
let card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid('900172162530279445'));
|
||||
assert.equal(card.chat_type, 11);
|
||||
card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid('926978638295859236'));
|
||||
assert.equal(card.chat_type, 17);
|
||||
assert.equal(card.origin_chat_type, 11);
|
||||
},
|
||||
// 4
|
||||
async () => {
|
||||
// assert.equal(await bili_client.getOneDynamicByDyid("111111111111111111"), undefined);
|
||||
// assert.notEqual(await bili_client.getOneDynamicByDyid("746824225190314008"), undefined);
|
||||
// assert.equal(await bili_client.getOneDynamicByDyid("761475750233636886"), undefined);
|
||||
},
|
||||
// 5
|
||||
async () => {
|
||||
let card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid('762591475338838053'));
|
||||
let chats = await bili_client.getChat(card.rid_str, card.chat_type);
|
||||
assert.equal(chats.length, 19);
|
||||
card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid('762502724122050647'));
|
||||
chats = await bili_client.getChat(card.rid_str, card.chat_type);
|
||||
assert.equal(chats.filter(it => it[0] === '六的月').length, 0);
|
||||
},
|
||||
// 6
|
||||
async () => {
|
||||
const dy = await bili_client.getOneDynamicByDyid('774973685666676768');
|
||||
const card = searcher.parseDynamicCard(dy);
|
||||
assert.notEqual(card.description + '', undefined + '');
|
||||
},
|
||||
// 7
|
||||
async () => {
|
||||
const dy = await bili_client.getOneDynamicByDyid('924676093465591832');
|
||||
const card = searcher.parseDynamicCard(dy);
|
||||
assert.equal(card.reserve_id, '3715576');
|
||||
},
|
||||
// 8
|
||||
async () => {
|
||||
const dy = await bili_client.getOneDynamicByDyid('925061227481137187');
|
||||
const card = searcher.parseDynamicCard(dy);
|
||||
assert.equal(card.origin_reserve_id, '3715576');
|
||||
let info = await bili_client.getOneDynamicByDyid('1210278611064455168');
|
||||
let card = searcher.parseDynamicCard(info);
|
||||
console.log(JSON.stringify(card, null, 4));
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
console.log('dynamic_card.test ... ok!');
|
||||
})();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user