mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9ebbb30eb | ||
|
|
b36c555c13 | ||
|
|
7338e09caf | ||
|
|
80a54e87f8 | ||
|
|
1a6291471a | ||
|
|
449c8d9272 | ||
|
|
136379a3aa | ||
|
|
313942adb7 | ||
|
|
66efd62d56 | ||
|
|
d7cf7422f4 | ||
|
|
094e019063 | ||
|
|
8de74537f7 | ||
|
|
70c10f247b | ||
|
|
2f26a393ca |
@@ -6,13 +6,8 @@ on:
|
||||
- main
|
||||
paths:
|
||||
- "lib/**"
|
||||
- "main.js"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "lib/**"
|
||||
- "main.js"
|
||||
- "*.js"
|
||||
- "*.json"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
name: "Package Node.js project into an executable"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "lib/**"
|
||||
- "main.js"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "lib/**"
|
||||
- "main.js"
|
||||
- "*.js"
|
||||
- "*.json"
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build_all:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -42,4 +37,5 @@ jobs:
|
||||
with:
|
||||
file: "dist/*.zip"
|
||||
delete_file: "dist/*.zip"
|
||||
tag_name: "v*.*.*"
|
||||
overwrite: true
|
||||
|
||||
@@ -3,6 +3,7 @@ node_modules/
|
||||
tests/
|
||||
dyids/
|
||||
dist/
|
||||
*.log
|
||||
package-lock.json
|
||||
env.js
|
||||
my_config.js
|
||||
@@ -1,5 +1,29 @@
|
||||
<!-- markdownlint-disable MD036 MD024-->
|
||||
# CHANGELOG
|
||||
## 主要变化(2.3.9)
|
||||
* b36c555 ci: auto gen changelog
|
||||
* 7338e09 feat: 更新`notice_key_words`
|
||||
* 80a54e8 ci: `*.exe` `latest_version0`
|
||||
* 1a62914 feat: 新增设置`is_outof_maxfollow`(#80)
|
||||
* 449c8d9 docs: update README
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.3.8)
|
||||
* 313942a ci: pkg.yml tag_name
|
||||
* 66efd62 feat: 新增设置`use_public_blacklist`
|
||||
* d7cf742 feat: 增加粉丝数查询第三方接口
|
||||
* 094e019 fix: 二级转发带有效抽奖
|
||||
* 8de7453 fix: description获取不到
|
||||
* 70c10f2 fix: 更改默认设置`key_words` `blockword`
|
||||
* 2f26a39 feat: 源uid参与筛选判断
|
||||
## 较上一版本变化
|
||||
* 变更可执行文件
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
**Full Changelog**: https://github.com/shanmiteko/LotteryAutoScript/compare/v2.3.7...v2.3.8
|
||||
|
||||
## 主要变化(2.3.7)
|
||||
* 50e18e2 feat: 下载更新时有多个版本
|
||||
* b9c73bd chore: change docker auto build
|
||||
|
||||
@@ -230,6 +230,8 @@ $ tree
|
||||
└── start.sh
|
||||
```
|
||||
|
||||
[](https://asciinema.org/a/453237)
|
||||
|
||||
3.更新
|
||||
|
||||
进入lottery上一级目录
|
||||
|
||||
+84
-46
@@ -63,6 +63,15 @@ class Monitor extends Searcher {
|
||||
config.is_exception = true;
|
||||
event_bus.emit('Turn_on_the_Monitor')
|
||||
break
|
||||
case 23:
|
||||
log.warn('关注已达上限', `UID(${global_var.get('myUID')})关注已达上限,已临时进入只转已关注模式`)
|
||||
if (!config.is_outof_maxfollow) {
|
||||
await sendNotify('[动态抽奖]关注已达上限', `UID: ${global_var.get('myUID')}\n\n关注已达上限,已临时进入只转已关注模式\n\n可在设置中令is_outof_maxfollow为true关闭此推送`)
|
||||
}
|
||||
config.is_outof_maxfollow = true;
|
||||
config.only_followed = true;
|
||||
event_bus.emit('Turn_on_the_Monitor')
|
||||
break
|
||||
case 31:
|
||||
event_bus.emit('Turn_off_the_Monitor', '转发失败')
|
||||
break
|
||||
@@ -89,12 +98,23 @@ class Monitor extends Searcher {
|
||||
log.info('筛选动态', `筛选完毕(${len})`);
|
||||
|
||||
if (len) {
|
||||
let is_exception = false;
|
||||
for (const [index, Lottery] of shuffle(allLottery).entries()) {
|
||||
let
|
||||
is_exception = 0,
|
||||
is_outof_maxfollow = 0;
|
||||
for (const [index, lottery] of shuffle(allLottery).entries()) {
|
||||
let status = 0;
|
||||
|
||||
if (Lottery.isOfficialLottery) {
|
||||
let { ts } = await bili.getLotteryNotice(Lottery.dyid);
|
||||
if (
|
||||
is_outof_maxfollow
|
||||
&& lottery.uid.length
|
||||
&& (new RegExp(lottery.uid.join('|'))).test(this.attentionList)
|
||||
) {
|
||||
log.info('过滤', `已关注(${lottery.uid.join(',')})`)
|
||||
continue
|
||||
}
|
||||
|
||||
if (lottery.isOfficialLottery) {
|
||||
let { ts } = await bili.getLotteryNotice(lottery.dyid);
|
||||
const ts_10 = Date.now() / 1000;
|
||||
if (ts < 0) {
|
||||
return 41
|
||||
@@ -109,10 +129,10 @@ class Monitor extends Searcher {
|
||||
await delay(filter_wait)
|
||||
continue
|
||||
}
|
||||
} else if (Lottery.uid[0]) {
|
||||
} else if (lottery.uid[0]) {
|
||||
const { minfollower } = config
|
||||
if (minfollower > 0) {
|
||||
const followerNum = await bili.getUserInfo(Lottery.uid[0]);
|
||||
const followerNum = await bili.getUserInfo(lottery.uid[0]);
|
||||
if (followerNum < 0) {
|
||||
return 51
|
||||
}
|
||||
@@ -135,14 +155,17 @@ class Monitor extends Searcher {
|
||||
randomDynamic(number)
|
||||
}
|
||||
|
||||
status = await this.go(Lottery)
|
||||
status = await this.go(lottery)
|
||||
switch (status) {
|
||||
case 0:
|
||||
case 9:
|
||||
case 19:
|
||||
break;
|
||||
case 22:
|
||||
is_exception = true
|
||||
is_exception = 22
|
||||
break;
|
||||
case 23:
|
||||
is_outof_maxfollow = 23
|
||||
break;
|
||||
default:
|
||||
return status
|
||||
@@ -151,11 +174,9 @@ class Monitor extends Searcher {
|
||||
await delay(wait * (Math.random() + 0.5));
|
||||
}
|
||||
log.info('抽奖', '开始转发下一组动态');
|
||||
if (is_exception) {
|
||||
return 22
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
return is_exception
|
||||
|| is_outof_maxfollow
|
||||
|| 0
|
||||
} else {
|
||||
log.info('抽奖', '无未转发抽奖');
|
||||
return 0
|
||||
@@ -188,12 +209,10 @@ class Monitor extends Searcher {
|
||||
|
||||
log.info('筛选动态', `开始筛选(${protoLotteryInfo.length})`);
|
||||
|
||||
log.debug('未进行筛选的动态信息', protoLotteryInfo);
|
||||
|
||||
/** 所有抽奖信息 */
|
||||
let alllotteryinfo = [];
|
||||
const
|
||||
{ set_lottery_info_url, key_words, model, chatmodel, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist } = config,
|
||||
{ set_lottery_info_url, key_words, model, chatmodel, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist, use_public_blacklist } = config,
|
||||
now_ts = Date.now() / 1000;
|
||||
|
||||
/**
|
||||
@@ -235,63 +254,79 @@ class Monitor extends Searcher {
|
||||
}
|
||||
|
||||
/* 检查动态是否满足要求 */
|
||||
await try_for_each(protoLotteryInfo, async function ({
|
||||
lottery_info_type, is_liked,
|
||||
uids, uname, dyid, create_time,
|
||||
ctrl, rid, des, type,
|
||||
hasOfficialLottery
|
||||
}) {
|
||||
await try_for_each(protoLotteryInfo, async function (lottery_info) {
|
||||
const {
|
||||
lottery_info_type, is_liked,
|
||||
uids, uname, dyid, create_time,
|
||||
ctrl, rid, des, type,
|
||||
hasOfficialLottery
|
||||
} = lottery_info;
|
||||
|
||||
log.debug('正在筛选的动态信息', lottery_info);
|
||||
|
||||
/* 遇到转发过就退出 */
|
||||
if (is_liked) {
|
||||
log.info("筛选动态", `已转发(${dyid})`)
|
||||
log.info("筛选动态", `已转发(https://t.bilibili.com/${dyid})`)
|
||||
return false
|
||||
}
|
||||
|
||||
/* 超过指定时间退出 */
|
||||
if (now_ts - create_time > max_create_time * 86400) {
|
||||
log.info("筛选动态", `过时动态(${dyid})`)
|
||||
log.info("筛选动态", `过时动态(https://t.bilibili.com/${dyid})`)
|
||||
return false
|
||||
}
|
||||
|
||||
const
|
||||
/**判断是转发源动态还是现动态 */
|
||||
uid = lottery_info_type === 'uid' ? uids[1] : uids[0],
|
||||
isFollowed = (new RegExp(uid)).test(attentionList),
|
||||
description = typeof des === 'string' ? des : '',
|
||||
[m_uid, ori_uid] = uids,
|
||||
mIsFollowed = m_uid && (new RegExp(m_uid)).test(attentionList),
|
||||
oriIsFollowed = ori_uid && (new RegExp(ori_uid)).test(attentionList),
|
||||
/**判断是转发源动态还是现动态 实际发奖人*/
|
||||
[real_uid, realIsFollowed] = lottery_info_type === 'uid'
|
||||
? [ori_uid, oriIsFollowed]
|
||||
: [m_uid, mIsFollowed],
|
||||
description = des.split(/\/\/@.*?:/)[0],
|
||||
needAt = /(?:@|艾特)[^@|(艾特)]*?好友/.test(description),
|
||||
needTopic = [...new Set(description.match(/(?<=[带加上](?:话题|tag).*)#.+?#|(?<=[带加上])#.+?#(?=话题|tag)/ig) || [])].join(' '),
|
||||
isRelayDynamic = type === 1,
|
||||
isTwoLevelDynamic = /\/\/@/.test(description),
|
||||
has_key_words = key_words.every(it => new RegExp(it).test(description)),
|
||||
isBlock = new RegExp(blockword.join('|')).test(description),
|
||||
isLottery =
|
||||
(is_imitator && lottery_info_type === 'uid' && model !== '00')
|
||||
|| (hasOfficialLottery && model[0] === '1')
|
||||
|| (!hasOfficialLottery && model[1] === '1' && !isTwoLevelDynamic && has_key_words),
|
||||
|| (!hasOfficialLottery && model[1] === '1' && has_key_words),
|
||||
isSendChat =
|
||||
(is_imitator && lottery_info_type === 'uid' && chatmodel !== '00')
|
||||
|| (hasOfficialLottery && chatmodel[0] === '1')
|
||||
|| (!hasOfficialLottery && chatmodel[1] === '1');
|
||||
|
||||
log.debug("筛选动态", { real_uid, mIsFollowed, oriIsFollowed, realIsFollowed, needAt, needTopic, isRelayDynamic, key_words, has_key_words, blockword, isBlock, isLottery, isSendChat })
|
||||
|
||||
/**屏蔽词 */
|
||||
if (isBlock) {
|
||||
log.info("筛选动态", `包含屏蔽词(${dyid})`)
|
||||
log.info("筛选动态", `包含屏蔽词(https://t.bilibili.com/${dyid})`)
|
||||
return false
|
||||
}
|
||||
|
||||
/**若勾选只转已关注 */
|
||||
if (only_followed && !isFollowed) {
|
||||
log.info("筛选动态", `只转已关注(${dyid})`)
|
||||
if (only_followed && !mIsFollowed && !oriIsFollowed) {
|
||||
log.info("筛选动态", `只转已关注(https://t.bilibili.com/${dyid})`)
|
||||
return false
|
||||
}
|
||||
|
||||
/* 获取黑名单并去重合并 */
|
||||
const { blacklist: remote_blacklist } = global_var.get("remoteconfig")
|
||||
, new_blacklist = remote_blacklist
|
||||
? [...new Set([...blacklist.split(','), ...remote_blacklist.split(',')])].join()
|
||||
const
|
||||
{ blacklist: remote_blacklist } = use_public_blacklist === false
|
||||
? { blacklist: "" }
|
||||
: global_var.get("remoteconfig"),
|
||||
/* 获取黑名单并去重合并 */
|
||||
new_blacklist = remote_blacklist
|
||||
? [
|
||||
...new Set([...blacklist.split(','),
|
||||
...remote_blacklist.split(',')])
|
||||
].join()
|
||||
: blacklist;
|
||||
if ((new RegExp(dyid + '|' + uid)).test(new_blacklist)) {
|
||||
log.info("筛选动态", `黑名单用户(${dyid})`)
|
||||
|
||||
if ((new RegExp(dyid + '|' + m_uid + '|' + ori_uid)).test(new_blacklist)) {
|
||||
log.info("筛选动态", `公共黑名单用户(https://t.bilibili.com/${dyid})`)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -304,8 +339,8 @@ class Monitor extends Searcher {
|
||||
/**初始化待关注列表 */
|
||||
onelotteryinfo.uid = []
|
||||
|
||||
if (!isFollowed) {
|
||||
onelotteryinfo.uid.push(uid);
|
||||
if (!realIsFollowed) {
|
||||
onelotteryinfo.uid.push(real_uid);
|
||||
}
|
||||
|
||||
onelotteryinfo.dyid = dyid;
|
||||
@@ -335,12 +370,12 @@ class Monitor extends Searcher {
|
||||
}
|
||||
|
||||
/* 是否是转发的动态 */
|
||||
if (isRelayDynamic) {
|
||||
if (isRelayDynamic && real_uid) {
|
||||
/* 转发内容长度+'//'+'@'+用户名+':'+源内容 */
|
||||
const addlength = RandomStr.length + 2 + uname.length + 1 + 1;
|
||||
onelotteryinfo.relay_chat = RandomStr + `//@${uname}:` + des;
|
||||
new_ctrl.push({
|
||||
data: String(uid),
|
||||
data: String(real_uid),
|
||||
location: RandomStr.length + 2,
|
||||
length: uname.length + 1,
|
||||
type: 1
|
||||
@@ -349,8 +384,9 @@ class Monitor extends Searcher {
|
||||
item.location += addlength;
|
||||
return item;
|
||||
}).forEach(it => new_ctrl.push(it))
|
||||
if (!(new RegExp(uids[1])).test(attentionList))
|
||||
onelotteryinfo.uid.push(uids[1]);
|
||||
if (!oriIsFollowed) {
|
||||
onelotteryinfo.uid.push(ori_uid);
|
||||
}
|
||||
} else {
|
||||
onelotteryinfo.relay_chat = RandomStr;
|
||||
}
|
||||
@@ -372,7 +408,7 @@ class Monitor extends Searcher {
|
||||
|
||||
alllotteryinfo.push(onelotteryinfo);
|
||||
} else {
|
||||
log.info("筛选动态", `非抽奖动态(${dyid})`)
|
||||
log.info("筛选动态", `非抽奖动态(https://t.bilibili.com/${dyid})`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -388,6 +424,7 @@ class Monitor extends Searcher {
|
||||
* 19 - 关注黑名单
|
||||
* 21 - 关注错误
|
||||
* 22 - 关注异常
|
||||
* 23 - 关注已达上限
|
||||
* 31 - 转发失败
|
||||
*/
|
||||
async go(option) {
|
||||
@@ -437,6 +474,7 @@ class Monitor extends Searcher {
|
||||
return false
|
||||
case -1:
|
||||
case 2:
|
||||
case 3:
|
||||
log.warn('抽奖信息', `uid: ${u},dyid: ${dyid}`)
|
||||
return true
|
||||
default:
|
||||
|
||||
@@ -75,7 +75,10 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
/* 是否有官方抽奖 */
|
||||
obj.hasOfficialLottery = extension && extension.lott && true;
|
||||
/* 转发者的描述 后两个分别是视频动态的描述和视频本身的描述*/
|
||||
obj.description = (item && (item.content || item.description || cardToJson.dynamic || cardToJson.desc)) || '';
|
||||
obj.description =
|
||||
(item && (item.content + item.description))
|
||||
|| (cardToJson.dynamic + cardToJson.desc)
|
||||
|| '';
|
||||
if (obj.type === 1) {
|
||||
const { origin_extension, origin } = cardToJson
|
||||
, originToJson = strToJson(origin)
|
||||
@@ -93,7 +96,10 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
/* 被转发者的name */
|
||||
obj.origin_uname = (user && (user.name || user.uname)) || '';
|
||||
/* 被转发者的描述 */
|
||||
obj.origin_description = (item && (item.content || item.description || originToJson.dynamic || originToJson.desc)) || '';
|
||||
obj.origin_description =
|
||||
(item && (item.content + item.description))
|
||||
|| (originToJson.dynamic + originToJson.desc)
|
||||
|| '';
|
||||
}
|
||||
|
||||
return obj
|
||||
|
||||
+17
-5
@@ -49,8 +49,8 @@ const config = {
|
||||
* 符合js正则表达式的字符串
|
||||
*/
|
||||
key_words: [
|
||||
"[抽奖]",
|
||||
"[转关].*[转关]"
|
||||
"[抽奖送]",
|
||||
"[转关评]"
|
||||
],
|
||||
|
||||
/**
|
||||
@@ -221,15 +221,20 @@ const config = {
|
||||
at_users: [['转发抽奖娘', 294887687], ['你的工具人老公', 100680137]],
|
||||
|
||||
/**
|
||||
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
|
||||
* - 英文逗号分隔 如: 1,2,3
|
||||
*/
|
||||
blacklist: '',
|
||||
|
||||
/**
|
||||
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
|
||||
* - 使用公共黑名单
|
||||
*/
|
||||
use_public_blacklist: true,
|
||||
|
||||
/**
|
||||
* 屏蔽词
|
||||
*/
|
||||
blockword: ["脚本抽奖", "恭喜", "结果", "抽奖号", "钓鱼", "涨粉"],
|
||||
blockword: ["脚本", "抽奖号", "钓鱼"],
|
||||
|
||||
/**
|
||||
* 转发评语
|
||||
@@ -258,6 +263,11 @@ const config = {
|
||||
*/
|
||||
is_exception: false,
|
||||
|
||||
/**
|
||||
* 是否关注已达上限
|
||||
*/
|
||||
is_outof_maxfollow: false,
|
||||
|
||||
/**
|
||||
* - 中奖通知关键词(满足一个就推送)
|
||||
* - 符合js正则表达式的字符串
|
||||
@@ -266,7 +276,9 @@ const config = {
|
||||
*/
|
||||
notice_key_words: [
|
||||
"~预约成功|预约主题",
|
||||
"中奖|获得|填写|写上|提供|收货地址|支付宝账号|码|大会员"
|
||||
"中奖|获得|填写|写上|提供|收货地址|支付宝账号|码|大会员",
|
||||
"~你的账号在新设备或平台登录成功",
|
||||
"~你预约的直播已开始"
|
||||
],
|
||||
|
||||
/**
|
||||
|
||||
+16
-2
@@ -526,6 +526,17 @@ const bili_client = {
|
||||
query: {
|
||||
vmid: uid
|
||||
}
|
||||
}),
|
||||
/**
|
||||
* 线路三
|
||||
* @param {number} uid
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
(uid) => get({
|
||||
url: "https://tenapi.cn/bilibilifo/",
|
||||
query: {
|
||||
uid
|
||||
}
|
||||
})
|
||||
], responseText => {
|
||||
const res = strToJson(responseText);
|
||||
@@ -609,9 +620,11 @@ const bili_client = {
|
||||
case 22002:
|
||||
return [false, -1, '您已被对方拉入黑名单']
|
||||
case 22003:
|
||||
return [false, -1, '黑名单用户无法关注', -1]
|
||||
return [false, -1, '黑名单用户无法关注']
|
||||
case 22015:
|
||||
return [false, 2, '账号异常', 2]
|
||||
return [false, 2, '账号异常']
|
||||
case 22009:
|
||||
return [false, 3, '关注已达上限']
|
||||
default:
|
||||
return [true, 1, `未知错误\n${responseText}`]
|
||||
}
|
||||
@@ -627,6 +640,7 @@ const bili_client = {
|
||||
* 0 - 成功
|
||||
* 1 - 失败
|
||||
* 2 - 异常
|
||||
* 3 - 关注已达上限
|
||||
*/
|
||||
autoAttention(uid) {
|
||||
return this._autoAttention.run(uid)
|
||||
|
||||
+17
-5
@@ -63,8 +63,8 @@ module.exports = Object.freeze({
|
||||
* 符合js正则表达式的字符串
|
||||
*/
|
||||
key_words: [
|
||||
"[抽奖]",
|
||||
"[转关].*[转关]"
|
||||
"[抽奖送]",
|
||||
"[转关评]"
|
||||
],
|
||||
|
||||
/**
|
||||
@@ -235,15 +235,20 @@ module.exports = Object.freeze({
|
||||
at_users: [['转发抽奖娘', 294887687], ['你的工具人老公', 100680137]],
|
||||
|
||||
/**
|
||||
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
|
||||
* - 英文逗号分隔 如: 1,2,3
|
||||
*/
|
||||
blacklist: '',
|
||||
|
||||
/**
|
||||
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
|
||||
* - 使用公共黑名单
|
||||
*/
|
||||
use_public_blacklist: true,
|
||||
|
||||
/**
|
||||
* 屏蔽词
|
||||
*/
|
||||
blockword: ["脚本抽奖", "恭喜", "结果", "抽奖号", "钓鱼", "涨粉"],
|
||||
blockword: ["脚本", "抽奖号", "钓鱼"],
|
||||
|
||||
/**
|
||||
* 转发评语
|
||||
@@ -272,6 +277,11 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
is_exception: false,
|
||||
|
||||
/**
|
||||
* 是否关注已达上限
|
||||
*/
|
||||
is_outof_maxfollow: false,
|
||||
|
||||
/**
|
||||
* - 中奖通知关键词(满足一个就推送)
|
||||
* - 符合js正则表达式的字符串
|
||||
@@ -280,7 +290,9 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
notice_key_words: [
|
||||
"~预约成功|预约主题",
|
||||
"中奖|获得|填写|写上|提供|收货地址|支付宝账号|码|大会员"
|
||||
"中奖|获得|填写|写上|提供|收货地址|支付宝账号|码|大会员",
|
||||
"~你的账号在新设备或平台登录成功",
|
||||
"~你预约的直播已开始"
|
||||
],
|
||||
|
||||
/**
|
||||
|
||||
+4
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lottery-auto-script",
|
||||
"version": "2.3.7",
|
||||
"version": "2.3.9",
|
||||
"description": "自动参与B站动态抽奖",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
@@ -8,7 +8,8 @@
|
||||
"clear": "node main.js clear",
|
||||
"check": "node main.js check",
|
||||
"update": "node main.js update",
|
||||
"build_all": "bash script/build/pkg.sh"
|
||||
"build_all": "bash script/build/pkg.sh",
|
||||
"changelog": "bash script/build/changelog.sh"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
@@ -53,4 +54,4 @@
|
||||
"chalk": "^4.1.2",
|
||||
"nodemailer": "^6.7.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# version: <major.minor.patch>
|
||||
level=patch
|
||||
|
||||
npm version $level \
|
||||
--no-commit-hooks \
|
||||
--no-git-tag-version
|
||||
|
||||
OLD_VERSION_ARRAY=($(npm view lottery-auto-script version | tr '.' ' '))
|
||||
major=${OLD_VERSION_ARRAY[0]}
|
||||
minor=${OLD_VERSION_ARRAY[1]}
|
||||
patch=${OLD_VERSION_ARRAY[2]}
|
||||
|
||||
case "${level}" in
|
||||
"major")
|
||||
((major += 1))
|
||||
;;
|
||||
"minor")
|
||||
((minor += 1))
|
||||
;;
|
||||
*)
|
||||
((patch += 1))
|
||||
;;
|
||||
esac
|
||||
|
||||
NEW_VERSION="$major.$minor.$patch"
|
||||
|
||||
echo "New Version: $NEW_VERSION"
|
||||
|
||||
GIT_LOG="$(git log --pretty=format:"* %h %s" | sed -e '/CHANGELOG/,$d' | sed ':a;N;s/\n/\\n/g;ta')"
|
||||
|
||||
sed -i "/# CHANGELOG/a\## 主要变化($NEW_VERSION)\n$GIT_LOG\n\n_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_\n" CHANGELOG.md
|
||||
|
||||
git add .
|
||||
git commit -m "docs: 更新CHANGELOG"
|
||||
+6
-3
@@ -35,13 +35,16 @@ for file in "$TARGET_DIR/"*; do
|
||||
for item in "${BATS[@]}"; do
|
||||
create_win_bat "${item}" >"$TMPDIR/$item.bat"
|
||||
done
|
||||
mv "$TMPDIR/$BIN_NAME" "$TMPDIR/$BIN_NAME.exe"
|
||||
else
|
||||
ZIP_NAME=latest_version0
|
||||
cat >"$TMPDIR/update.sh" <<-EOF
|
||||
#!/bin/bash
|
||||
./lottery update
|
||||
if [[ -r "latest_version.zip" ]]; then
|
||||
unzip latest_version.zip
|
||||
rm latest_version0.zip
|
||||
ZIP_NAME=$ZIP_NAME
|
||||
if [[ -r "\$ZIP_NAME.zip" ]]; then
|
||||
unzip \$ZIP_NAME.zip
|
||||
rm \$ZIP_NAME.zip
|
||||
chmod u+x lottery
|
||||
fi
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user