koishi-plugin-bilibili-notify 1.1.0-rc.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/comRegister.js +6 -14
- package/lib/index.js +0 -1
- package/package.json +2 -1
- package/readme.md +2 -0
package/lib/comRegister.js
CHANGED
|
@@ -320,7 +320,7 @@ class ComRegister {
|
|
|
320
320
|
msg = '请求错误';
|
|
321
321
|
break;
|
|
322
322
|
case -403:
|
|
323
|
-
msg = '
|
|
323
|
+
msg = '访问权限不足,尝试重新登录,如果不行请联系作者';
|
|
324
324
|
break;
|
|
325
325
|
case -404:
|
|
326
326
|
msg = '用户不存在';
|
|
@@ -359,10 +359,12 @@ class ComRegister {
|
|
|
359
359
|
else {
|
|
360
360
|
return '暂不支持群号发送';
|
|
361
361
|
}
|
|
362
|
+
// 获取直播房间号
|
|
363
|
+
let roomId = data.live_room?.roomid.toString();
|
|
362
364
|
// 保存到数据库中
|
|
363
365
|
const sub = await ctx.database.create('bilibili', {
|
|
364
366
|
uid: mid,
|
|
365
|
-
room_id:
|
|
367
|
+
room_id: roomId,
|
|
366
368
|
dynamic: dynamicMsg ? 1 : 0,
|
|
367
369
|
video: 1,
|
|
368
370
|
live: liveMsg ? 1 : 0,
|
|
@@ -378,7 +380,7 @@ class ComRegister {
|
|
|
378
380
|
id: sub.id,
|
|
379
381
|
uid: mid,
|
|
380
382
|
targetId: guildId,
|
|
381
|
-
roomId
|
|
383
|
+
roomId,
|
|
382
384
|
live: liveMsg,
|
|
383
385
|
dynamic: dynamicMsg,
|
|
384
386
|
liveDispose: null,
|
|
@@ -395,7 +397,7 @@ class ComRegister {
|
|
|
395
397
|
}
|
|
396
398
|
// 需要订阅直播
|
|
397
399
|
if (liveMsg) {
|
|
398
|
-
await session.execute(`bili live ${
|
|
400
|
+
await session.execute(`bili live ${roomId} ${guildId} -b ${session.event.platform}`);
|
|
399
401
|
// 发送订阅消息通知
|
|
400
402
|
await session.send(`订阅${userData.info.uname}直播通知`);
|
|
401
403
|
}
|
|
@@ -539,14 +541,7 @@ class ComRegister {
|
|
|
539
541
|
dynamicDetect(ctx, bot, guildId, uid) {
|
|
540
542
|
let firstSubscription = true;
|
|
541
543
|
let timePoint;
|
|
542
|
-
// Test code
|
|
543
|
-
// let timer = 0
|
|
544
544
|
return async () => {
|
|
545
|
-
// Test code
|
|
546
|
-
/* this.logger.info('timer:' + timer++)
|
|
547
|
-
this.logger.info('firstSubscription:' + firstSubscription)
|
|
548
|
-
this.logger.info(`timePoint: ${timePoint}`)
|
|
549
|
-
this.logger.info(`timePoint: ${ctx.gimg.unixTimestampToString(timePoint)}`) */
|
|
550
545
|
// 第一次订阅判断
|
|
551
546
|
if (firstSubscription) {
|
|
552
547
|
// 设置第一次的时间点
|
|
@@ -584,9 +579,6 @@ class ComRegister {
|
|
|
584
579
|
// 没有动态内容则直接跳过
|
|
585
580
|
if (!items[num])
|
|
586
581
|
continue;
|
|
587
|
-
// Test code
|
|
588
|
-
/* this.logger.info(`items[${num}].modules.module_author.pub_ts: ${items[num].modules.module_author.pub_ts}`)
|
|
589
|
-
this.logger.info(`items[${num}].modules.module_author.pub_ts: ${ctx.gimg.unixTimestampToString(items[num].modules.module_author.pub_ts)}`) */
|
|
590
582
|
// 寻找发布时间比时间点更晚的动态
|
|
591
583
|
if (items[num].modules.module_author.pub_ts > timePoint) {
|
|
592
584
|
// 推送该条动态
|
package/lib/index.js
CHANGED
|
@@ -51,7 +51,6 @@ exports.Config = koishi_1.Schema.object({
|
|
|
51
51
|
.description('解锁3个订阅限制,默认只允许订阅3位UP主。订阅过多用户可能有导致IP暂时被封禁的风险'),
|
|
52
52
|
liveStartAtAll: koishi_1.Schema.boolean()
|
|
53
53
|
.default(false)
|
|
54
|
-
.experimental()
|
|
55
54
|
.description('直播开始时艾特全体成员,默认关闭'),
|
|
56
55
|
pushTime: koishi_1.Schema.number()
|
|
57
56
|
.min(0)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-bilibili-notify",
|
|
3
3
|
"description": "Koishi bilibili notify plugin",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Akokko <admin@akokko.com>"
|
|
7
7
|
],
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"koishi": "^4.16.8"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"axios": "^1.6.7",
|
|
30
31
|
"axios-cookiejar-support": "^5.0.0",
|
|
31
32
|
"jsdom": "^24.0.0",
|
|
32
33
|
"md5": "^2.3.0",
|
package/readme.md
CHANGED
|
@@ -93,6 +93,8 @@
|
|
|
93
93
|
- ver 1.1.0-alpha.0 修复了直播订阅一段时间过后提示房间不存在的bug,修复了自动登录刷新错误的bug
|
|
94
94
|
- ver 1.1.0-beta.0 修复了一个bug(如果本身已经存在乱码问题的情况下,使用page模式仍然会乱码),修复了日志bug
|
|
95
95
|
- ver 1.1.0-rc.0 修复了订阅用户直播一段时间后提示用户直播间不存在并自动取消订阅的bug
|
|
96
|
+
- ver 1.1.0 移除了直播艾特全体成员选项实验性的标志,优化了直播房间号的获取逻辑,移除了部分测试代码
|
|
97
|
+
- ver 1.1.1 新增依赖axios
|
|
96
98
|
|
|
97
99
|
## 感谢
|
|
98
100
|
|