Compare commits

...
23 Commits
Author SHA1 Message Date
shanmite 3bc7dafe3e doc: 图片换源gitlab 2022-05-21 17:02:01 +08:00
shanmite 23432edb74 docs: 更新CHANGELOG 2022-05-21 16:36:07 +08:00
shanmite df7b3210a3 fix: 远程设置换源gitlab 2022-05-21 16:35:26 +08:00
shanmite 31e8941415 docs: 更新CHANGELOG 2022-05-03 10:01:55 +08:00
shanmite f329457c9a fix: 评论包含敏感词(#150)
Fixed #150
2022-05-03 09:55:53 +08:00
shanmiteandGitHub 0eddee4f15 Merge pull request #147 from spiritLHLS/patch-1
更换仓库地址
2022-04-11 09:21:36 +08:00
spiritLHLSandGitHub ce2c9e58dd Update README.md
备份迁移至此号
2022-04-11 09:10:09 +08:00
spiritLHLSandGitHub f1bbc9d1da Update README.md
备份迁移至此号
2022-04-11 08:53:58 +08:00
shanmite 29bb2f32a3 docs: 更新CHANGELOG 2022-03-23 15:58:12 +08:00
shanmite 22e4d2aaa1 fix: 转发了不含关键词的抽奖动态(#136)
Fixed #136
2022-03-23 15:04:59 +08:00
shanmite 354d8cff1a fix: 推送异常(#132)
Fixed #132
2022-03-22 15:02:59 +08:00
shanmite 1b80f853ed docs: 更新CHANGELOG 2022-03-02 19:49:10 +08:00
shanmite b1f478cb8e feat: 可选通知现阶段运行到哪个账号(#132)
新增设置`notice_running_state`
 Fixed #132
2022-03-02 19:44:27 +08:00
shanmite 39d69e0448 docs: 更新CHANGELOG 2022-03-01 21:17:53 +08:00
shanmite 45ac58e312 fix: 评论与转发相同时去掉动态原文(#128)
Fixed #128
2022-03-01 21:08:33 +08:00
shanmite a0d910632a docs: 更新CHANGELOG 2022-02-08 11:37:43 +08:00
shanmite 41b954081a fix: 未知错误退出 2022-02-08 11:34:30 +08:00
shanmite 2723048bb3 docs: 更新CHANGELOG 2022-02-07 15:27:09 +08:00
shanmite 3f59076d83 feat: 推送中奖检测可添加账号备注(#121)
详见env.example.js
2022-02-07 15:05:10 +08:00
shanmite b80c65558d docs: 更新CHANGELOG 2022-02-04 10:20:22 +08:00
shanmite f569207dc5 fix: 低版本node(< v15)不支持replaceAll
Nodejs v15 has V8 8.6 and thus that's the
 first nodejs version where you can use .replaceAll()
2022-02-04 10:18:20 +08:00
shanmite 6dbb9854c8 docs: 更新CHANGELOG 2022-02-03 11:53:24 +08:00
shanmite 2fbd292e7a feat: 自动评语中可用up主昵称${uname}变量(#118)
例如:
relay: ["祝${uname}早日百大!"]
2022-02-03 11:46:04 +08:00
15 changed files with 141 additions and 38 deletions
+50
View File
@@ -1,5 +1,55 @@
<!-- markdownlint-disable MD036 MD024-->
# CHANGELOG
## 主要变化(2.5.5)
* df7b321 fix: 远程设置换源gitlab
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.5.4)
* f329457 fix: 评论包含敏感词(#150)
* 0eddee4 Merge pull request #147 from spiritLHLS/patch-1
* ce2c9e5 Update README.md
* f1bbc9d Update README.md
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.5.3)
* 22e4d2a fix: 转发了不含关键词的抽奖动态(#136)
* 354d8cf fix: 推送异常(#132)
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.5.2)
* b1f478c feat: 可选通知现阶段运行到哪个账号(#132)
* 新增设置`notice_running_state`
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.5.1)
* 45ac58e fix: 评论与转发相同时去掉动态原文(#128)
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.5.0)
* 41b9540 fix: 未知错误退出
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.4.11)
* 3f59076 feat: 推送中奖检测可添加账号备注(#121)
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.4.10)
* f569207 fix: 低版本node(< v15)不支持replaceAll
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.4.9)
* 2fbd292 feat: 自动评语中可用up主昵称`${uname}`变量(#118)
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
## 主要变化(2.4.8)
* 266ecf7 feat: 添加Qmsg酱推送(#115)
* 4d90d83 feat: 日志细节优化
+9 -9
View File
@@ -59,7 +59,7 @@ Chrome浏览器:
(此步骤是为了方便后续采用JS获取Cookies,获取完毕后应再次勾选)
![取消httponly](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/getCookies.png)
![取消httponly](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/getCookies.png)
3. 在Console中复制以下代码回车
@@ -126,7 +126,7 @@ Chrome浏览器:
```
7. 运行截图
![lottery_start](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/lottery_start.png)
![lottery_start](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/lottery_start.png)
#### 以源码方式运行
@@ -140,7 +140,7 @@ step1: 下载代码到本地
[点此下载](https://github.com/shanmiteko/LotteryAutoScript/archive/refs/heads/main.zip)或如图示下载↓
![点我加载下载操作图示](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/download.png)
![点我加载下载操作图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/download.png)
下载的压缩包解压后修改env.example.js文件,详见step3
@@ -148,7 +148,7 @@ step2: 下载并安装Node.js
[点此进入nodejs下载页面](http://nodejs.cn/download)
![点我加载下载nodejs操作图示](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/nodejs.png)
![点我加载下载nodejs操作图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/nodejs.png)
step3:修改env.example.js文件及创建运行文件(打开扩展名显示)
@@ -270,14 +270,14 @@ $ tree
| :---------------: | :--------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/bark.jpg)(注:支持自建填完整链接即可) |
| `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://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/DD_bot.png) |
| `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/) |
@@ -303,6 +303,6 @@ $ tree
## Awesome
相关项目
- [LotteryAutoScript_Station](https://github.com/spiritLHL/LotteryAutoScript_Station) - [@spiritLHL](https://github.com/spiritLHL)
- [sync_lottery](https://github.com/spiritLHL/sync_lottery) - [@spiritLHL](https://github.com/spiritLHL)
- [BDSF](https://github.com/spiritLHL/BDSF) - [@spiritLHL](https://github.com/spiritLHL)
- [LotteryAutoScript_Station](https://github.com/spiritLHLS/LotteryAutoScript_Station) - [@spiritLHL](https://github.com/spiritLHLS)
- [sync_lottery](https://github.com/spiritLHLS/sync_lottery) - [@spiritLHL](https://github.com/spiritLHLS)
- [BDSF](https://github.com/spiritLHLS/BDSF) - [@spiritLHL](https://github.com/spiritLHLS)
+3 -3
View File
@@ -4,16 +4,16 @@
.首先在Telegram上搜索[BotFather](https://t.me/BotFather)机器人<br>
![TG_PUSH1](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/TG_PUSH1.png)
![TG_PUSH1](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/TG_PUSH1.png)
Ⅱ.利用[BotFather](https://t.me/BotFather)创建一个属于自己的通知机器人,按照下图中的1、2、3步骤拿到token,格式形如```10xxx4:AAFcqxxxxgER5uw```。填入```TG_BOT_TOKEN```<br>
![TG_PUSH2](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/TG_PUSH2.png)<br>
![TG_PUSH2](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/TG_PUSH2.png)<br>
**新创建的机器人需要跟它发一条消息来开启对话,否则可能会遇到secret填对了但是收不到消息的情况**<br>
Ⅲ.再次在Telegram上搜索[getuserIDbot](https://t.me/getuserIDbot)机器人,获取UserID。填入```TG_USER_ID```<br>
![TG_PUSH3](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/TG_PUSH3.png)
![TG_PUSH3](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/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://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/image-start.png)
![image-start](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/image-start.png)
7.如果本地的脚本需要更新
+3 -3
View File
@@ -16,13 +16,13 @@
7.在`操作`页面中点击`新建`,选择操作为`启动程序`,在设置里点击浏览找到`start.bat`文件并选择,在`起始于(可选)(T)`中的空白框里输入`start.bat`文件的目录地址,也就是`程序或脚本(P)``start.bat`的前面那一串目录地址,最后是以`\`结尾的 ,填好东西后按下面`确认`
![点我加载步骤7结果图示](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/step_menu.png)
![点我加载步骤7结果图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/step_menu.png)
8.在`条件`页面中选择`网络`,设定启动条件为任何连接
9.在`设置`页面中选择如图示选项,或者不修改默认设置
![点我加载步骤9结果图示](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/shezhi_renwu.png)
![点我加载步骤9结果图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/shezhi_renwu.png)
10.最后按`确定`
@@ -30,6 +30,6 @@
最后你可以在任务列表中选择已有的任务,右边的操作框中选择`运行`点击,启动计划的任务,如下图所示
![点我加载运行图示](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/start_renwu.png)
![点我加载运行图示](https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/doc/pic/start_renwu.png)
具体看任务是否正常执行,你可以看看自己的账号动态的最新转发,运行成功每几分钟自动转发抽奖动态
+9
View File
@@ -2,6 +2,7 @@ module.exports = Object.freeze({
/**
* ## 账号相关
* - `COOKIE` 是必填项
* - `NOTE` 帐号备注
* - `NUMBER` 表示是第几个账号
* - `CLEAR` 是否启用清理功能
* - `ENABLE_MULTIPLE_ACCOUNT` 是否启用多账号
@@ -18,6 +19,7 @@ module.exports = Object.freeze({
*/
account_parm: {
COOKIE: "",
NOTE: "",
NUMBER: 1,
CLEAR: true,
@@ -31,10 +33,17 @@ module.exports = Object.freeze({
/**
* 为防止环境变量过长, 请将多账号填在此处
* 以大括号内容为模板依次复制(包含大括号),逗号分割
* ```
* ...
* NUMBER: 1
* ...
* NUMBER: 2
* ```
*/
multiple_account_parm: [
{
COOKIE: "",
NOTE: "",
NUMBER: 1,
CLEAR: true,
WAIT: 60 * 1000
+4 -2
View File
@@ -7,8 +7,9 @@ const bili = require('./net/bili')
/**
* 是否中奖
* @param {number} num
* @param {string} [note]
*/
async function isMe(num) {
async function isMe(num, note = "无") {
let desp = '';
const
{ notice_key_words, update_session_wait, get_session_wait, check_session_pages } = config,
@@ -93,7 +94,8 @@ async function isMe(num) {
log.info('中奖检测', '--> OK');
}
if (desp) {
desp += '中奖了别忘给脚本(https://github.com/shanmiteko/LotteryAutoScript)点一个Star哦, 赞助一两块也不是不可以‍_(:з」∠)_\n\n'
desp += `帐号备注: ${note}\n\n`;
desp += '中奖了别忘给脚本(https://github.com/shanmiteko/LotteryAutoScript)点一个Star哦, 赞助一两块也不是不可以_(:з」∠)_\n\n'
log.info('可能中奖了', desp);
await sendNotify(`帐号${num}可能中奖了`, desp);
} else {
+24 -7
View File
@@ -184,6 +184,7 @@ class Monitor extends Searcher {
case 5002:
case 5003:
case 5004:
status = 0
break;
case 2004:
is_exception = 2004
@@ -223,8 +224,9 @@ class Monitor extends Searcher {
* @property {boolean} isOfficialLottery 是否官方抽奖
* @property {string} relay_chat 转发词
* @property {string} ctrl 定位@
* @property {string} rid 评论标识
* @property {string} [rid] 评论标识
* @property {number} chat_type 评论类型
* @property {string} [chat] 评论词
*/
/**
* @returns {Promise<LotteryOptions[]>}
@@ -244,7 +246,7 @@ class Monitor extends Searcher {
/** 所有抽奖信息 */
let alllotteryinfo = [];
const
{ check_if_duplicated, set_lottery_info_url, sneaktower, key_words, model, chatmodel, block_dynamic_type, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist, use_public_blacklist } = config,
{ check_if_duplicated, set_lottery_info_url, 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;
/**
@@ -373,6 +375,7 @@ class Monitor extends Searcher {
if (!has_key_words && description) {
log.warn("筛选动态", `无关键词动态的描述: ${description}\n\n考虑是否修改设置key_words:\n${key_words.join('\n')}`)
return false
}
/**屏蔽词 */
@@ -403,6 +406,7 @@ class Monitor extends Searcher {
}
if (isLottery) {
const { uname_map = {} } = global_var.get("remoteconfig")
let onelotteryinfo = {};
onelotteryinfo.isOfficialLottery = hasOfficialLottery;
@@ -418,7 +422,8 @@ class Monitor extends Searcher {
let
/**转发评语 */
RandomStr = getRandomOne(config.relay),
RandomStr = getRandomOne(relays)
.replace(/\$\{uname\}/g, uname_map[real_uid] || uname),
/**控制字段 */
new_ctrl = [];
@@ -475,7 +480,11 @@ class Monitor extends Searcher {
: 0;
/* 是否评论 */
if (isSendChat) onelotteryinfo.rid = rid;
if (isSendChat) {
onelotteryinfo.rid = rid
onelotteryinfo.chat = getRandomOne(chats)
.replace(/\$\{uname\}/g, uname_map[real_uid] || uname)
}
alllotteryinfo.push(onelotteryinfo);
} else {
@@ -520,8 +529,8 @@ class Monitor extends Searcher {
let status = 0
const
{ uid, dyid, chat_type, rid, relay_chat, ctrl } = option,
{ chat, check_if_duplicated, is_repost_then_chat } = config;
{ uid, dyid, chat_type, rid, relay_chat, ctrl, chat } = option,
{ check_if_duplicated, is_repost_then_chat } = config;
/* 评论 */
if (rid && chat_type) {
@@ -531,11 +540,19 @@ class Monitor extends Searcher {
[1, 4],
() => bili.sendChat(
rid,
is_repost_then_chat ? relay_chat : getRandomOne(chat),
is_repost_then_chat ? relay_chat.split('//')[0] : chat,
chat_type
)
)
if (status === 8) {
status = await bili.sendChat(
rid,
"[doge]",
chat_type
)
}
if (status) {
log.warn("抽奖信息", `dyid: ${dyid}, rid: ${rid}, chat_type: ${chat_type}`)
return 1000 + status
+5
View File
@@ -317,6 +317,11 @@ const config = {
"~你预约的直播已开始"
],
/**
* 是否发送运行状态通知
*/
notice_running_state: false,
/**
* - 获取私信页数
*/
+10 -3
View File
@@ -5,6 +5,7 @@ const { Searcher } = require('./core/searcher');
const { Monitor } = require('./core/monitor');
const config = require('./data/config');
const { randomDynamic } = require('./helper/randomDynamic');
const { sendNotify } = require('./helper/notify');
const { log } = utils;
async function createRandomDynamic(num) {
@@ -23,18 +24,21 @@ async function createRandomDynamic(num) {
/**
* 抽奖主函数
* @param {string} cookie
* @param {string} num
* @returns {Promise<void>}
*/
function start() {
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");
if (lotterys.length === 0) {
log.info('抽奖', '抽奖信息为空');
resolve();
event_bus.emit('Turn_off_the_Monitor', '抽奖信息为空')
return;
}
if (times.value() === lotterys.length) {
@@ -48,6 +52,9 @@ function start() {
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);
event_bus.flush();
+5 -1
View File
@@ -951,6 +951,7 @@ const bili_client = {
* - 已被对方拉入黑名单 5
* - 黑名单用户无法互动 6
* - UP主已关闭评论区 7
* - 评论内容包含敏感信息 8
*/
async sendChat(rid, msg, type) {
const
@@ -966,7 +967,7 @@ const bili_client = {
res = strToJson(responseText);
switch (res.code) {
case 0:
log.info('自动评论', '评论成功');
log.info('自动评论', `评论成功: ${msg}`);
return 0;
case -404:
log.error('自动评论', '原动态已删除');
@@ -986,6 +987,9 @@ const bili_client = {
case 12061:
log.error('自动评论', 'UP主已关闭评论区');
return 7;
case 12016:
log.error('自动评论', '评论内容包含敏感信息');
return 8;
default:
log.error('自动评论', `未知错误\n${responseText}`);
return 1;
+4 -5
View File
@@ -291,11 +291,9 @@ const utils = {
return new Promise((resolve) => {
send({
method: 'GET',
url: 'https://gitee.com/shanmite/lottery-notice/raw/master/notice.json',
url: 'https://gitlab.com/shanmiteko/lottery-notice/-/raw/master/notice.json',
headers: {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
accept: 'text/plain; charset=utf-8',
referer: 'https://gitee.com/shanmite/lottery-notice/blob/master/notice.json',
},
success: res => {
try {
@@ -303,12 +301,13 @@ const utils = {
if (body.node_msg) utils.log.info('公告', '\n' + body.node_msg + '\n');
resolve(body.config)
} catch (error) {
resolve(JSON.parse('{}'))
utils.log.error('获取远程设置', '获取远程设置错误: ' + error);
resolve({})
}
},
failure: err => {
utils.log.error('获取远程设置', '获取远程设置错误: ' + err);
resolve(JSON.parse('{}'));
resolve({})
}
})
})
+4 -3
View File
@@ -21,7 +21,7 @@ let loop_wait = 0;
* @returns {Promise<string>} 错误信息
*/
async function main() {
const { COOKIE, NUMBER, CLEAR, ENABLE_MULTIPLE_ACCOUNT, MULTIPLE_ACCOUNT_PARM } = process.env;
const { COOKIE, NOTE, NUMBER, CLEAR, ENABLE_MULTIPLE_ACCOUNT, MULTIPLE_ACCOUNT_PARM } = process.env;
if (ENABLE_MULTIPLE_ACCOUNT) {
let muti_acco = multiple_account.length
? multiple_account
@@ -33,6 +33,7 @@ async function main() {
process.env.COOKIE = acco.COOKIE;
process.env.NUMBER = acco.NUMBER;
process.env.CLEAR = acco.CLEAR;
process.env.NOTE = acco.NOTE;
const err_msg = await main();
if (err_msg) {
return err_msg
@@ -60,12 +61,12 @@ async function main() {
case 'start':
log.info('抽奖', '开始运行');
loop_wait = lottery_loop_wait;
await start();
await start(NUMBER);
break;
case 'check':
log.info('中奖检测', '检查是否中奖');
loop_wait = check_loop_wait;
await isMe(NUMBER);
await isMe(NUMBER, NOTE);
break;
case 'clear':
if (CLEAR) {
+9
View File
@@ -289,11 +289,15 @@ module.exports = Object.freeze({
/**
* 转发评语
* 支持变量${uname}
*/
relay: ['转发动态'],
/**
* 评论内容
* 支持变量${uname}
* @example
* "祝${uname}早日百大!"
*/
chat: [
'[OK]', '[星星眼]', '[歪嘴]', '[喜欢]', '[偷笑]', '[笑]', '[喜极而泣]', '[辣眼睛]', '[吃瓜]', '[奋斗]',
@@ -332,6 +336,11 @@ module.exports = Object.freeze({
"~你预约的直播已开始"
],
/**
* 是否发送运行状态通知
*/
notice_running_state: false,
/**
* - 获取私信页数
*/
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "lottery-auto-script",
"version": "2.4.8",
"version": "2.5.5",
"description": "自动参与B站动态抽奖",
"main": "main.js",
"scripts": {