Compare commits

...
9 Commits
Author SHA1 Message Date
shanmite 33a1d1a38b docs: 更新CHANGELOG
Build and push Docker images / docker (push) Has been cancelled
Mirror and run GitLab CI / build (push) Has been cancelled
Publishing to NPM / publish (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, linux) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, macos) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, win) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (alpine) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linux) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linuxstatic) (push) Has been cancelled
2025-12-17 08:17:09 +08:00
shanmite d0a0dd9219 feat: 新增QMSG_SOCKET推送参数支持私有云 (#473)
Fixed #473
2025-12-17 08:12:11 +08:00
shanmite d40daa2b0a docs: 注解默认设置
Build and push Docker images / docker (push) Has been cancelled
Mirror and run GitLab CI / build (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, linux) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, macos) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, win) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (alpine) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linux) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linuxstatic) (push) Has been cancelled
2025-08-25 16:01:31 +08:00
shanmite a0856faa4e fix: 风控导致动态内容为空 (#465)
Build and push Docker images / docker (push) Has been cancelled
Mirror and run GitLab CI / build (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, linux) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, macos) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, win) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (alpine) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linux) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linuxstatic) (push) Has been cancelled
Fixed #465
2025-08-25 15:47:48 +08:00
shanmite 7172e58d28 docs: 更新CHANGELOG
Build and push Docker images / docker (push) Has been cancelled
Mirror and run GitLab CI / build (push) Has been cancelled
Publishing to NPM / publish (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, linux) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, macos) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, win) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (alpine) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linux) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linuxstatic) (push) Has been cancelled
2025-08-19 15:11:42 +08:00
shanmite 30bf989aa3 feat: ai评论支持所有兼容OpenAI API的平台 (#463)
Fixed #463
2025-08-19 15:09:25 +08:00
shanmite 15c1d22469 fix: 官方非官方抽奖类型判断 (#461)
Fixed #461
2025-08-19 11:18:10 +08:00
shanmite adbfb6bb38 docs: 更新CHANGELOG
Build and push Docker images / docker (push) Has been cancelled
Mirror and run GitLab CI / build (push) Has been cancelled
Publishing to NPM / publish (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, linux) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, macos) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, win) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (alpine) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linux) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linuxstatic) (push) Has been cancelled
2025-08-08 15:17:14 +08:00
amadeus5201andGitHub b74bb02c65 feat: ai 评论 (#462)
Build and push Docker images / docker (push) Has been cancelled
Mirror and run GitLab CI / build (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, linux) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, macos) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, win) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (alpine) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linux) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linuxstatic) (push) Has been cancelled
* feat: ai content

* style: 更改ai调用方式
2025-08-08 10:20:16 +08:00
11 changed files with 216 additions and 63 deletions
+18
View File
@@ -1,5 +1,23 @@
<!-- markdownlint-disable MD036 MD024-->
# CHANGELOG
## 主要变化(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)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.9.8)
* c85c910 doc: 图片链接换源
* c4d37ed fix: Dockerfile.pkg-arm64换源
+32 -31
View File
@@ -33,7 +33,7 @@
- 监控用户转发
- 监控话题页面
- 监控专栏合集
- 自动点赞、评论、乱序转发、@好友、带话题、可选随机动态
- 自动点赞、AI评论、乱序转发、@好友、带话题、可选随机动态
- 直播预约抽奖
- 检测是否中奖
- 已读@
@@ -204,36 +204,37 @@ buvid3亦可不填 使用随机生成值
以下是支持的推送方式
| 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) |
| `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 -7
View File
@@ -6,16 +6,19 @@ 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_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 +34,11 @@ 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_COMMENTS: false,
ENABLE_MULTIPLE_ACCOUNT: false,
MULTIPLE_ACCOUNT_PARM: '',
LOTTERY_LOG_LEVEL: 3,
NOT_GO_LOTTERY: ''
},
@@ -65,10 +70,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 +100,7 @@ module.exports = Object.freeze({
IGOT_PUSH_KEY: '',
PUSH_PLUS_TOKEN: '',
PUSH_PLUS_USER: '',
QMSG_SOCKET: '',
QMSG_KEY: '',
QMSG_QQ: '',
SMTP_HOST: '',
@@ -104,5 +110,15 @@ module.exports = Object.freeze({
SMTP_TO_USER: '',
GOTIFY_URL: '',
GOTIFY_APPKEY: ''
},
/**
* AI Authentication(OpenAI 兼容的 API 格式)
* Chat completions
* 此处填写Key, 在my_config中的ai_comments_parm中填写API地址等信息
*/
ai_parm: {
//apikey
AI_API_KEY: '',
}
});
+23 -4
View File
@@ -1,4 +1,4 @@
const { log, hasEnv, shuffle, getRandomOne, delay, try_for_each, retryfn, appendLotteryInfoFile } = require('../utils');
const { log, hasEnv, shuffle, getRandomOne, getAiContent, delay, try_for_each, retryfn, appendLotteryInfoFile } = require('../utils');
const { send } = require('../net/http');
const bili = require('../net/bili');
const { sendNotify } = require('../helper/notify');
@@ -281,7 +281,7 @@ 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,
only_followed, at_users, blockword, blacklist, ai_comments_parm
} = config,
now_ts = Date.now() / 1000;
@@ -354,6 +354,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 {
@@ -527,8 +532,22 @@ class Monitor extends Searcher {
/* 是否评论 */
if (isSendChat) {
onelotteryinfo.rid = rid;
onelotteryinfo.chat = (getRandomOne(chats) || '!!!')
.replace(/\$\{uname\}/g, uname);
if (hasEnv('ENABLE_AI_COMMENTS')) {
try {
log.info('开始获取Ai评论', `(https://t.bilibili.com/${dyid})`);
onelotteryinfo.chat = await getAiContent(
ai_comments_parm.url,
ai_comments_parm.body,
ai_comments_parm.prompt,
lottery_info.des) || '!!!';
log.info('获取到Ai评论内容', `${onelotteryinfo.chat}`);
} catch (e) {
log.error('获取AI评论失败,使用随机评论', e);
onelotteryinfo.chat = (getRandomOne(chats) || '!!!').replace(/\$\{uname\}/g, uname);
}
} else {
onelotteryinfo.chat = (getRandomOne(chats) || '!!!').replace(/\$\{uname\}/g, uname);
}
}
alllotteryinfo.push(onelotteryinfo);
+17 -7
View File
@@ -252,6 +252,8 @@ function oldParseDynamicCard(dynamic_detail_card) {
/* 定位@信息 */
obj.ctrl = (extendjsonToJson.ctrl) || [];
/* 预约抽奖信息 */
obj.reserve_id = '';
obj.reserve_lottery_text = '信息丢失';
if (add_on_card_info.length > 0) {
const [status, oid_str, text] = add_on_card_info
.filter(it => typeof it.reserve_attach_card !== 'undefined'
@@ -278,7 +280,7 @@ function oldParseDynamicCard(dynamic_detail_card) {
obj.is_charge_lottery = true;
}
/* 是否有官方抽奖 */
obj.hasOfficialLottery = extension && extension.lott && true;
obj.hasOfficialLottery = extension && extension.lott && true || false;
/* 转发者的描述 纯文字内容 图片动态描述 后两个分别是视频动态的描述和视频本身的描述*/
obj.description =
(item && ((item.content || '') + (item.description || '')))
@@ -288,6 +290,9 @@ function oldParseDynamicCard(dynamic_detail_card) {
+ (cardToJson.vest && cardToJson.vest.content || '')
)
|| '';
if (obj.description.startsWith('互动抽奖 ')) {
obj.hasOfficialLottery = true;
}
/* 转发 */
if (obj.type === 1) {
const { origin_extension, origin, origin_extend_json = '{}' } = cardToJson
@@ -308,6 +313,8 @@ function oldParseDynamicCard(dynamic_detail_card) {
/* 被转发者的动态的ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
obj.origin_dynamic_id = desc.orig_dy_id_str;
/* 预约抽奖信息 */
obj.origin_reserve_id = '';
obj.origin_reserve_lottery_text = '信息丢失';
if (add_on_card_info.length > 0) {
const [status, oid_str, text] = add_on_card_info
.filter(it => typeof it.reserve_attach_card !== 'undefined'
@@ -334,7 +341,7 @@ function oldParseDynamicCard(dynamic_detail_card) {
obj.origin_is_charge_lottery = true;
}
/* 是否有官方抽奖 */
obj.origin_hasOfficialLottery = origin_extension && origin_extension.lott;
obj.origin_hasOfficialLottery = origin_extension && origin_extension.lott || false;
/* 被转发者的name */
obj.origin_uname = (user && (user.name || user.uname)) || '';
/* 被转发者的描述 */
@@ -342,6 +349,9 @@ function oldParseDynamicCard(dynamic_detail_card) {
(item && (item.content || '' + item.description || ''))
|| (originToJson.dynamic || '' + originToJson.desc || '')
|| '';
if (obj.origin_description.startsWith('互动抽奖 ')) {
obj.origin_hasOfficialLottery = true;
}
}
} catch (e) {
log.error('动态卡片解析', e);
@@ -364,9 +374,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 +448,8 @@ class Searcher {
// 当 offset 为 '0'(初始页)时,传入 offset 会报错
const OneDynamicInfo = offset === '0'
? await hadUidGetOneDynamicInfoByUID()
: await hadUidGetOneDynamicInfoByUID(offset);
? await hadUidGetOneDynamicInfoByUID()
: await hadUidGetOneDynamicInfoByUID(offset);
const mDRdata = modifyDynamicRes(OneDynamicInfo);
+6
View File
@@ -332,6 +332,12 @@ const config = {
'坚持不懈,迎难而上,开拓创新!', '[OK][OK]', '我来抽个奖', '中中中中中中', '[doge][doge][doge]', '我我我',
],
ai_comments_parm: {
url: '',
body: {},
prompt: ''
},
/**
* 是否抄热评
*/
+2 -1
View File
@@ -13,7 +13,8 @@ const env = {
const raw_env = this.raw_env();
this.setEnv({
...raw_env['account_parm'],
...raw_env['push_parm']
...raw_env['push_parm'],
...raw_env['ai_parm']
});
},
/**
+11 -4
View File
@@ -70,6 +70,7 @@ let PUSH_PLUS_TOKEN = '';
let PUSH_PLUS_USER = '';
// ===========================================QMSG===========================================
let QMSG_SOCKET = '';
let QMSG_KEY = '';
let QMSG_QQ = '';
@@ -173,6 +174,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;
}
@@ -619,7 +626,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 +655,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]}`,
@@ -883,7 +890,7 @@ async function qmsg(text, desp) {
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
+44 -1
View File
@@ -508,7 +508,50 @@ const utils = {
}).catch((err) => {
console.error('获取' + printMessage + '地址失败', err);
});
}
},
/**
* 获取ai评论
* @param {string} url
* @param {object} body
* @param {string} prompt
* @param {string} content
* @returns {Promise<string|null>}
*/
getAiContent(url, body, prompt, content) {
return new Promise((resolve) => {
send({
method: 'POST',
url,
headers: {
'authorization': 'Bearer ' + process.env.AI_API_KEY,
'content-type': 'application/json'
},
contents: {
...body,
'stream': false,
'enable_thinking': true,
'response_format': { 'type': 'text' },
'messages': [
{
'role': 'system',
'content': prompt
},
{
'role': 'user',
'content': content
}
]
},
success: res => {
const data = utils.strToJson(res.body);
resolve(data?.choices?.[0]?.message?.content || null);
},
failure: () => {
resolve(null);
}
});
});
},
};
+39 -7
View File
@@ -341,6 +341,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: ''
},
/**
* 是否抄热评
*/
@@ -459,7 +472,7 @@ module.exports = Object.freeze({
* 1
* [1,2,4]
*/
clear_dynamic_type: [1]
clear_dynamic_type: [1],
},
/**
@@ -470,15 +483,12 @@ module.exports = Object.freeze({
/**
* 手动添加抽奖号UID
* - 抽奖动态下的二级小号
*
* 帐号1存储抽奖信息至文件
*/
UIDs: [],
TAGs: [
'互动抽奖',
'转发抽奖',
'动态抽奖',
'抽奖',
],
TAGs: [],
Articles: [
'抽奖合集'
@@ -486,8 +496,30 @@ module.exports = Object.freeze({
APIs: [],
/**
* 默认为硅基流动,可以修改为其他AI服务
*/
ai_comments_parm: {
url: 'https://api.siliconflow.cn/v1/chat/completions',
body: {
'model': 'Qwen/Qwen3-32B',
'max_tokens': 512,
'thinking_budget': 4096,
'min_p': 0.05,
'temperature': 0.7,
'top_p': 0.7,
'top_k': 50,
'frequency_penalty': 0.5,
'n': 1,
},
prompt: '请根据以下内容直接生成一条简短评论,无需说明信息,且不包含任何敏感词汇。'
},
save_lottery_info_to_file: true,
},
/**
* 后续帐号从文件提取抽奖信息转抽
*/
config_2: {},
config_3: {}
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "lottery-auto-script",
"version": "2.9.8",
"version": "2.10.2",
"description": "自动参与B站动态抽奖",
"main": "main.js",
"scripts": {