koishi-plugin-bilibili-notify 3.0.0-alpha.10 → 3.0.0-alpha.12
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/blive.d.ts +3 -11
- package/lib/blive.js +2 -24
- package/lib/comRegister.d.ts +2 -3
- package/lib/comRegister.js +72 -38
- package/lib/generateImg.d.ts +1 -0
- package/lib/generateImg.js +6 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.js +3 -19
- package/package.json +4 -1
- package/readme.md +2 -0
package/lib/blive.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Awaitable, Context,
|
|
1
|
+
import { Awaitable, Context, Service } from "koishi";
|
|
2
2
|
import { type MsgHandler } from 'blive-message-listener';
|
|
3
3
|
declare module 'koishi' {
|
|
4
4
|
interface Context {
|
|
@@ -7,18 +7,10 @@ declare module 'koishi' {
|
|
|
7
7
|
}
|
|
8
8
|
declare class BLive extends Service {
|
|
9
9
|
static inject: string[];
|
|
10
|
-
private blConfig;
|
|
11
10
|
private listenerRecord;
|
|
12
|
-
|
|
13
|
-
constructor(ctx: Context, config: BLive.Config);
|
|
11
|
+
constructor(ctx: Context);
|
|
14
12
|
protected stop(): Awaitable<void>;
|
|
15
|
-
startLiveRoomListener(roomId: string, handler: MsgHandler
|
|
13
|
+
startLiveRoomListener(roomId: string, handler: MsgHandler): Promise<void>;
|
|
16
14
|
closeListener(roomId: string): void;
|
|
17
15
|
}
|
|
18
|
-
declare namespace BLive {
|
|
19
|
-
interface Config {
|
|
20
|
-
danmakuPushTime: number;
|
|
21
|
-
}
|
|
22
|
-
const Config: Schema<Config>;
|
|
23
|
-
}
|
|
24
16
|
export default BLive;
|
package/lib/blive.js
CHANGED
|
@@ -5,16 +5,11 @@ const blive_message_listener_1 = require("blive-message-listener");
|
|
|
5
5
|
class BLive extends koishi_1.Service {
|
|
6
6
|
// 必要服务
|
|
7
7
|
static inject = ['ba'];
|
|
8
|
-
// 配置
|
|
9
|
-
blConfig;
|
|
10
8
|
// 定义类属性
|
|
11
9
|
listenerRecord = {};
|
|
12
|
-
|
|
13
|
-
constructor(ctx, config) {
|
|
10
|
+
constructor(ctx) {
|
|
14
11
|
// Extends super
|
|
15
12
|
super(ctx, 'bl');
|
|
16
|
-
// 将config赋值给类属性
|
|
17
|
-
this.blConfig = config;
|
|
18
13
|
}
|
|
19
14
|
// 注册插件dispose逻辑
|
|
20
15
|
stop() {
|
|
@@ -23,7 +18,7 @@ class BLive extends koishi_1.Service {
|
|
|
23
18
|
this.closeListener(key);
|
|
24
19
|
}
|
|
25
20
|
}
|
|
26
|
-
async startLiveRoomListener(roomId, handler
|
|
21
|
+
async startLiveRoomListener(roomId, handler) {
|
|
27
22
|
// 获取cookieStr
|
|
28
23
|
const cookiesStr = await this.ctx.ba.getCookiesForHeader();
|
|
29
24
|
// 获取自身信息
|
|
@@ -37,8 +32,6 @@ class BLive extends koishi_1.Service {
|
|
|
37
32
|
uid: mySelfInfo.data.mid
|
|
38
33
|
}
|
|
39
34
|
});
|
|
40
|
-
// 默认30s推送一次弹幕消息到群组并将dispose函数保存到Record中
|
|
41
|
-
this.timerRecord[roomId] = this.ctx.setInterval(danmakuPushTime, this.blConfig.danmakuPushTime * 1000 * 60);
|
|
42
35
|
// logger
|
|
43
36
|
this.logger.info(`${roomId}直播间弹幕监听已开启`);
|
|
44
37
|
}
|
|
@@ -48,21 +41,12 @@ class BLive extends koishi_1.Service {
|
|
|
48
41
|
// 输出logger
|
|
49
42
|
this.logger.info(`${roomId}直播间弹幕监听器无需关闭`);
|
|
50
43
|
}
|
|
51
|
-
// 判断消息发送定时器是否关闭
|
|
52
|
-
if (!this.timerRecord || !this.timerRecord[roomId]) {
|
|
53
|
-
// 输出logger
|
|
54
|
-
this.logger.info(`${roomId}直播间消息发送定时器无需关闭`);
|
|
55
|
-
}
|
|
56
44
|
// 关闭直播间监听器
|
|
57
45
|
this.listenerRecord[roomId].close();
|
|
58
|
-
// 关闭消息发送定时器
|
|
59
|
-
this.timerRecord[roomId]();
|
|
60
46
|
// 判断是否关闭成功
|
|
61
47
|
if (this.listenerRecord[roomId].closed) {
|
|
62
48
|
// 删除直播间监听器
|
|
63
49
|
delete this.listenerRecord[roomId];
|
|
64
|
-
// 删除消息发送定时器
|
|
65
|
-
delete this.timerRecord[roomId];
|
|
66
50
|
// 输出logger
|
|
67
51
|
this.logger.info(`${roomId}直播间弹幕监听已关闭`);
|
|
68
52
|
// 直接返回
|
|
@@ -72,10 +56,4 @@ class BLive extends koishi_1.Service {
|
|
|
72
56
|
this.logger.warn(`${roomId}直播间弹幕监听未成功关闭`);
|
|
73
57
|
}
|
|
74
58
|
}
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
76
|
-
(function (BLive) {
|
|
77
|
-
BLive.Config = koishi_1.Schema.object({
|
|
78
|
-
danmakuPushTime: koishi_1.Schema.number().required()
|
|
79
|
-
});
|
|
80
|
-
})(BLive || (BLive = {}));
|
|
81
59
|
exports.default = BLive;
|
package/lib/comRegister.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type ChannelIdArr = Array<{
|
|
|
11
11
|
channelId: string;
|
|
12
12
|
dynamic: boolean;
|
|
13
13
|
live: boolean;
|
|
14
|
-
|
|
14
|
+
liveGuardBuy: boolean;
|
|
15
15
|
atAll: boolean;
|
|
16
16
|
}>;
|
|
17
17
|
type TargetItem = {
|
|
@@ -97,7 +97,7 @@ declare namespace ComRegister {
|
|
|
97
97
|
channelId: string;
|
|
98
98
|
dynamic: boolean;
|
|
99
99
|
live: boolean;
|
|
100
|
-
|
|
100
|
+
liveGuardBuy: boolean;
|
|
101
101
|
atAll: boolean;
|
|
102
102
|
}>;
|
|
103
103
|
platform: string;
|
|
@@ -120,7 +120,6 @@ declare namespace ComRegister {
|
|
|
120
120
|
customLiveEnd: string;
|
|
121
121
|
dynamicUrl: boolean;
|
|
122
122
|
dynamicLoopTime: number;
|
|
123
|
-
dynamicCheckNumber: number;
|
|
124
123
|
filter: {
|
|
125
124
|
enable: boolean;
|
|
126
125
|
notify: boolean;
|
package/lib/comRegister.js
CHANGED
|
@@ -10,6 +10,9 @@ const jsx_runtime_1 = require("@satorijs/element/jsx-runtime");
|
|
|
10
10
|
const koishi_1 = require("koishi");
|
|
11
11
|
// 导入qrcode
|
|
12
12
|
const qrcode_1 = __importDefault(require("qrcode"));
|
|
13
|
+
// 弹幕词云
|
|
14
|
+
const segmentit_1 = require("segmentit");
|
|
15
|
+
const d3_cloud_1 = __importDefault(require("d3-cloud"));
|
|
13
16
|
var LiveType;
|
|
14
17
|
(function (LiveType) {
|
|
15
18
|
LiveType[LiveType["NotLiveBroadcast"] = 0] = "NotLiveBroadcast";
|
|
@@ -291,7 +294,7 @@ class ComRegister {
|
|
|
291
294
|
channelId: group,
|
|
292
295
|
dynamic: true,
|
|
293
296
|
live: true,
|
|
294
|
-
|
|
297
|
+
liveGuardBuy: false,
|
|
295
298
|
atAll: options.atAll
|
|
296
299
|
});
|
|
297
300
|
});
|
|
@@ -351,7 +354,7 @@ class ComRegister {
|
|
|
351
354
|
// 判断targetArr是否为空
|
|
352
355
|
if (target.length === 0) {
|
|
353
356
|
// 为空则默认为当前环境
|
|
354
|
-
target = [{ channelIdArr: [{ channelId: session.event.channel.id, dynamic: true, live: true,
|
|
357
|
+
target = [{ channelIdArr: [{ channelId: session.event.channel.id, dynamic: true, live: true, liveGuardBuy: false, atAll: options.atAll ? options.atAll : false }], platform: session.event.platform }];
|
|
355
358
|
// 没有满足条件的群组或频道
|
|
356
359
|
await session.send('没有满足条件的群组或频道,默认订阅到当前聊天环境');
|
|
357
360
|
}
|
|
@@ -362,7 +365,7 @@ class ComRegister {
|
|
|
362
365
|
}
|
|
363
366
|
else {
|
|
364
367
|
// 未填写群号或频道号,默认为当前环境
|
|
365
|
-
target = [{ channelIdArr: [{ channelId: session.event.channel.id, dynamic: true, live: true,
|
|
368
|
+
target = [{ channelIdArr: [{ channelId: session.event.channel.id, dynamic: true, live: true, liveGuardBuy: false, atAll: options.atAll ? options.atAll : false }], platform: session.event.platform }];
|
|
366
369
|
// 发送提示消息
|
|
367
370
|
await session.send('没有填写群号或频道号,默认订阅到当前聊天环境');
|
|
368
371
|
}
|
|
@@ -370,7 +373,7 @@ class ComRegister {
|
|
|
370
373
|
}
|
|
371
374
|
else {
|
|
372
375
|
// 用户直接订阅,将当前环境赋值给target
|
|
373
|
-
target = [{ channelIdArr: [{ channelId: session.event.channel.id, dynamic: true, live: true,
|
|
376
|
+
target = [{ channelIdArr: [{ channelId: session.event.channel.id, dynamic: true, live: true, liveGuardBuy: false, atAll: options.atAll ? options.atAll : false }], platform: session.event.platform }];
|
|
374
377
|
}
|
|
375
378
|
}
|
|
376
379
|
// 定义外围变量
|
|
@@ -622,7 +625,7 @@ class ComRegister {
|
|
|
622
625
|
const channelIdArr = idStr.split(',').map(id => {
|
|
623
626
|
const atAll = /@$/.test(id); // 使用正则表达式检查 id 是否以 @ 结尾
|
|
624
627
|
const channelId = atAll ? id.slice(0, -1) : id; // 去除末尾的 @
|
|
625
|
-
return { channelId, dynamic: true, live: true,
|
|
628
|
+
return { channelId, dynamic: true, live: true, liveGuardBuy: false, atAll };
|
|
626
629
|
});
|
|
627
630
|
return { channelIdArr, platform };
|
|
628
631
|
});
|
|
@@ -697,7 +700,7 @@ class ComRegister {
|
|
|
697
700
|
channelId: guild.id,
|
|
698
701
|
dynamic: target.channelIdArr[0].dynamic,
|
|
699
702
|
live: target.channelIdArr[0].live,
|
|
700
|
-
|
|
703
|
+
liveGuardBuy: target.channelIdArr[0].liveGuardBuy,
|
|
701
704
|
atAll: target.channelIdArr[0].atAll
|
|
702
705
|
});
|
|
703
706
|
}
|
|
@@ -1392,7 +1395,6 @@ class ComRegister {
|
|
|
1392
1395
|
let pushAtTimeTimer;
|
|
1393
1396
|
// 定义弹幕存放数组
|
|
1394
1397
|
const currentLiveDanmakuArr = [];
|
|
1395
|
-
const temporaryLiveDanmakuArr = [];
|
|
1396
1398
|
// 定义开播状态
|
|
1397
1399
|
let liveStatus = false;
|
|
1398
1400
|
// 处理target
|
|
@@ -1402,14 +1404,14 @@ class ComRegister {
|
|
|
1402
1404
|
let liveRoomInfo;
|
|
1403
1405
|
let masterInfo;
|
|
1404
1406
|
// 找到频道/群组对应的
|
|
1405
|
-
const
|
|
1407
|
+
const liveGuardBuyPushTargetArr = target.map(channel => {
|
|
1406
1408
|
// 获取符合条件的target
|
|
1407
|
-
const
|
|
1409
|
+
const liveGuardBuyArr = channel.channelIdArr.filter(channelId => channelId.liveGuardBuy);
|
|
1408
1410
|
// 将当前liveDanmakuArr的长度+到channelIdArrLen中
|
|
1409
|
-
channelIdArrLen +=
|
|
1411
|
+
channelIdArrLen += liveGuardBuyArr.length;
|
|
1410
1412
|
// 返回符合的target
|
|
1411
1413
|
return {
|
|
1412
|
-
channelIdArr:
|
|
1414
|
+
channelIdArr: liveGuardBuyArr,
|
|
1413
1415
|
platform: channel.platform
|
|
1414
1416
|
};
|
|
1415
1417
|
});
|
|
@@ -1435,25 +1437,62 @@ class ComRegister {
|
|
|
1435
1437
|
data: liveRoomInfo
|
|
1436
1438
|
}, LiveType.LiveBroadcast, liveMsg);
|
|
1437
1439
|
};
|
|
1438
|
-
//
|
|
1439
|
-
const
|
|
1440
|
-
//
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1440
|
+
// 定义获取弹幕权重Record函数
|
|
1441
|
+
const getDanmakuWeightRecord = () => {
|
|
1442
|
+
// 创建segmentit
|
|
1443
|
+
const segmentit = (0, segmentit_1.useDefault)(new segmentit_1.Segment());
|
|
1444
|
+
// 创建Record
|
|
1445
|
+
const danmakuWeightRecord = {};
|
|
1446
|
+
// 循环遍历currentLiveDanmakuArr
|
|
1447
|
+
for (const danmaku of currentLiveDanmakuArr) {
|
|
1448
|
+
// 遍历结果
|
|
1449
|
+
segmentit.doSegment(danmaku).map((word) => {
|
|
1450
|
+
// 定义权重
|
|
1451
|
+
danmakuWeightRecord[word.w] = (danmakuWeightRecord[word.w] || 0) + 1;
|
|
1452
|
+
});
|
|
1446
1453
|
}
|
|
1454
|
+
// 返回Record
|
|
1455
|
+
return danmakuWeightRecord;
|
|
1456
|
+
};
|
|
1457
|
+
// 定义获取弹幕词云函数
|
|
1458
|
+
const sendDanmakuWordCloud = (danmakuWeightRecord) => {
|
|
1459
|
+
// 准备词云数据
|
|
1460
|
+
const wordList = Object.keys(danmakuWeightRecord).map(word => ({ text: word, value: danmakuWeightRecord[word] }));
|
|
1461
|
+
// 创建画布
|
|
1462
|
+
const width = 800;
|
|
1463
|
+
const height = 600;
|
|
1464
|
+
// 定义绘制函数
|
|
1465
|
+
const generateSVG = async (words) => {
|
|
1466
|
+
// 定义svg头部
|
|
1467
|
+
const svgHeader = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">`;
|
|
1468
|
+
// 定义svg尾部
|
|
1469
|
+
const svgFooter = '</svg>';
|
|
1470
|
+
// 定义svg身体
|
|
1471
|
+
const svgBody = words.map(d => {
|
|
1472
|
+
return `<text x="${d.x}" y="${d.y}" font-family="Arial" font-size="${d.size}" fill="black">${d.text}</text>`;
|
|
1473
|
+
}).join('\n');
|
|
1474
|
+
// 拼接svg
|
|
1475
|
+
const svgContent = svgHeader + svgBody + svgFooter;
|
|
1476
|
+
// 渲染svg
|
|
1477
|
+
const pic = await this.ctx.gi.generateWordCloudImg(svgContent);
|
|
1478
|
+
// 发送消息
|
|
1479
|
+
this.sendMsg(target, pic);
|
|
1480
|
+
};
|
|
1481
|
+
// 配置词云
|
|
1482
|
+
const layout = (0, d3_cloud_1.default)()
|
|
1483
|
+
.size([width, height])
|
|
1484
|
+
.words(wordList.map(d => ({ text: d.text, size: d.value })))
|
|
1485
|
+
.padding(5)
|
|
1486
|
+
.font('Arial')
|
|
1487
|
+
.fontSize(d => d.size)
|
|
1488
|
+
.on('end', generateSVG);
|
|
1489
|
+
// 生成词云
|
|
1490
|
+
layout.start();
|
|
1447
1491
|
};
|
|
1448
1492
|
// 定义直播间信息获取函数
|
|
1449
1493
|
const useMasterAndLiveRoomInfo = async () => {
|
|
1450
|
-
//
|
|
1494
|
+
// 定义函数是否执行成功flag
|
|
1451
1495
|
let flag = true;
|
|
1452
|
-
// 判断是否已存在值
|
|
1453
|
-
if (liveRoomInfo && masterInfo && liveTime) {
|
|
1454
|
-
// 所有值均已存在,不需要再获取信息
|
|
1455
|
-
return flag;
|
|
1456
|
-
}
|
|
1457
1496
|
// 获取直播间信息
|
|
1458
1497
|
liveRoomInfo = await this.useLiveRoomInfo(roomId).catch(() => {
|
|
1459
1498
|
// 设置flag为false
|
|
@@ -1492,24 +1531,18 @@ class ComRegister {
|
|
|
1492
1531
|
this.logger.info('直播间连接已断开');
|
|
1493
1532
|
},
|
|
1494
1533
|
onIncomeDanmu: ({ body }) => {
|
|
1495
|
-
// 处理消息,只需要UP主名字和消息内容
|
|
1496
|
-
const content = `【${masterInfo.username}的直播间】${body.user.uname}:${body.content}`;
|
|
1497
1534
|
// 保存消息到数组
|
|
1498
1535
|
currentLiveDanmakuArr.push(body.content);
|
|
1499
|
-
temporaryLiveDanmakuArr.push(content);
|
|
1500
1536
|
},
|
|
1501
1537
|
onIncomeSuperChat: ({ body }) => {
|
|
1502
|
-
// 处理SC消息
|
|
1503
|
-
const content = `【${masterInfo.username}的直播间】${body.user.uname}发送了一条SC:${body.content}`;
|
|
1504
1538
|
// 保存消息到数组
|
|
1505
1539
|
currentLiveDanmakuArr.push(body.content);
|
|
1506
|
-
temporaryLiveDanmakuArr.push(content);
|
|
1507
1540
|
},
|
|
1508
1541
|
onGuardBuy: ({ body }) => {
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1542
|
+
// 定义消息
|
|
1543
|
+
const content = `${body.user.uname}加入了大航海(${body.gift_name})`;
|
|
1544
|
+
// 直接发送消息
|
|
1545
|
+
channelIdArrLen > 0 && this.sendMsg(liveGuardBuyPushTargetArr, content);
|
|
1513
1546
|
},
|
|
1514
1547
|
onLiveStart: async () => {
|
|
1515
1548
|
// 判断是否已经开播
|
|
@@ -1567,12 +1600,14 @@ class ComRegister {
|
|
|
1567
1600
|
pushAtTimeTimer();
|
|
1568
1601
|
// 将推送定时器变量置空
|
|
1569
1602
|
pushAtTimeTimer = null;
|
|
1603
|
+
// 发送弹幕词云
|
|
1604
|
+
sendDanmakuWordCloud(getDanmakuWeightRecord());
|
|
1570
1605
|
// 将直播状态设置为false
|
|
1571
1606
|
liveStatus = false;
|
|
1572
1607
|
}
|
|
1573
1608
|
};
|
|
1574
1609
|
// 启动直播间弹幕监测
|
|
1575
|
-
await this.ctx.bl.startLiveRoomListener(roomId, handler
|
|
1610
|
+
await this.ctx.bl.startLiveRoomListener(roomId, handler);
|
|
1576
1611
|
// 判断直播状态
|
|
1577
1612
|
if (liveRoomInfo.live_status === 1) {
|
|
1578
1613
|
// 设置开播时间
|
|
@@ -2127,7 +2162,7 @@ class ComRegister {
|
|
|
2127
2162
|
channelId: koishi_1.Schema.string().description('频道/群组号'),
|
|
2128
2163
|
dynamic: koishi_1.Schema.boolean().description('该频道/群组是否推送动态信息'),
|
|
2129
2164
|
live: koishi_1.Schema.boolean().description('该频道/群组是否推送直播通知'),
|
|
2130
|
-
|
|
2165
|
+
liveGuardBuy: koishi_1.Schema.boolean().description('该频道/群组是否推送弹幕消息'),
|
|
2131
2166
|
atAll: koishi_1.Schema.boolean().description('推送开播通知时是否艾特全体成员')
|
|
2132
2167
|
})).description('频道/群组信息'),
|
|
2133
2168
|
platform: koishi_1.Schema.string().description('推送平台')
|
|
@@ -2153,7 +2188,6 @@ class ComRegister {
|
|
|
2153
2188
|
customLiveEnd: koishi_1.Schema.string().required(),
|
|
2154
2189
|
dynamicUrl: koishi_1.Schema.boolean().required(),
|
|
2155
2190
|
dynamicLoopTime: koishi_1.Schema.number().default(60),
|
|
2156
|
-
dynamicCheckNumber: koishi_1.Schema.number().required(),
|
|
2157
2191
|
filter: koishi_1.Schema.object({
|
|
2158
2192
|
enable: koishi_1.Schema.boolean(),
|
|
2159
2193
|
notify: koishi_1.Schema.boolean(),
|
package/lib/generateImg.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare class GenerateImg extends Service {
|
|
|
24
24
|
link: string;
|
|
25
25
|
buffer?: undefined;
|
|
26
26
|
}>;
|
|
27
|
+
generateWordCloudImg(svgContent: string): Promise<string>;
|
|
27
28
|
getLiveStatus(time: string, liveStatus: number): Promise<[string, string, boolean]>;
|
|
28
29
|
getTimeDifference(dateString: string): Promise<string>;
|
|
29
30
|
unixTimestampToString(timestamp: number): string;
|
package/lib/generateImg.js
CHANGED
|
@@ -1407,6 +1407,12 @@ class GenerateImg extends koishi_1.Service {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
1409
|
}
|
|
1410
|
+
async generateWordCloudImg(svgContent) {
|
|
1411
|
+
// 渲染图片
|
|
1412
|
+
const pic = await this.ctx.puppeteer.render(svgContent);
|
|
1413
|
+
// 返回图片
|
|
1414
|
+
return pic;
|
|
1415
|
+
}
|
|
1410
1416
|
async getLiveStatus(time, liveStatus) {
|
|
1411
1417
|
let titleStatus;
|
|
1412
1418
|
let liveTime;
|
package/lib/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface Config {
|
|
|
36
36
|
channelId: string;
|
|
37
37
|
dynamic: boolean;
|
|
38
38
|
live: boolean;
|
|
39
|
-
|
|
39
|
+
liveGuardBuy: boolean;
|
|
40
40
|
atAll: boolean;
|
|
41
41
|
}>;
|
|
42
42
|
platform: string;
|
|
@@ -44,13 +44,11 @@ export interface Config {
|
|
|
44
44
|
}>;
|
|
45
45
|
dynamic: {};
|
|
46
46
|
dynamicUrl: boolean;
|
|
47
|
-
dynamicCheckNumber: number;
|
|
48
47
|
dynamicLoopTime: '1分钟' | '2分钟' | '3分钟' | '5分钟' | '10分钟' | '20分钟';
|
|
49
48
|
live: {};
|
|
50
49
|
liveDetectMode: 'API' | 'WS';
|
|
51
50
|
restartPush: boolean;
|
|
52
51
|
pushTime: number;
|
|
53
|
-
danmakuPushTime: number;
|
|
54
52
|
customLiveStart: string;
|
|
55
53
|
customLive: string;
|
|
56
54
|
customLiveEnd: string;
|
package/lib/index.js
CHANGED
|
@@ -170,16 +170,13 @@ class ServerManager extends koishi_1.Service {
|
|
|
170
170
|
customLiveStart: globalConfig.customLiveStart,
|
|
171
171
|
customLive: globalConfig.customLive,
|
|
172
172
|
customLiveEnd: globalConfig.customLiveEnd,
|
|
173
|
-
dynamicCheckNumber: globalConfig.dynamicCheckNumber,
|
|
174
173
|
dynamicLoopTime: this.dynamicLoopTime,
|
|
175
174
|
dynamicUrl: globalConfig.dynamicUrl,
|
|
176
175
|
filter: globalConfig.filter,
|
|
177
176
|
dynamicDebugMode: globalConfig.dynamicDebugMode
|
|
178
177
|
});
|
|
179
178
|
// BL = BLive
|
|
180
|
-
const bl = this.ctx.plugin(blive_1.default
|
|
181
|
-
danmakuPushTime: globalConfig.danmakuPushTime
|
|
182
|
-
});
|
|
179
|
+
const bl = this.ctx.plugin(blive_1.default);
|
|
183
180
|
// 添加服务
|
|
184
181
|
this.servers.push(ba);
|
|
185
182
|
this.servers.push(bl);
|
|
@@ -235,7 +232,7 @@ function apply(ctx, config) {
|
|
|
235
232
|
globalConfig = config;
|
|
236
233
|
// 设置提示
|
|
237
234
|
ctx.notifier.create({
|
|
238
|
-
content: '从
|
|
235
|
+
content: '从3.0.0-alpha.10以前版本更新需重新订阅'
|
|
239
236
|
});
|
|
240
237
|
ctx.notifier.create({
|
|
241
238
|
content: '请使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令。'
|
|
@@ -314,7 +311,7 @@ exports.Config = koishi_1.Schema.object({
|
|
|
314
311
|
channelId: koishi_1.Schema.string().description('频道/群组号'),
|
|
315
312
|
dynamic: koishi_1.Schema.boolean().description('该频道/群组是否推送动态信息'),
|
|
316
313
|
live: koishi_1.Schema.boolean().description('该频道/群组是否推送直播通知'),
|
|
317
|
-
|
|
314
|
+
liveGuardBuy: koishi_1.Schema.boolean().description('该频道/群组是否推送上舰消息'),
|
|
318
315
|
atAll: koishi_1.Schema.boolean().description('推送开播通知时是否艾特全体成员')
|
|
319
316
|
})).description('频道/群组信息'),
|
|
320
317
|
platform: koishi_1.Schema.string().description('推送平台')
|
|
@@ -324,13 +321,6 @@ exports.Config = koishi_1.Schema.object({
|
|
|
324
321
|
dynamicUrl: koishi_1.Schema.boolean()
|
|
325
322
|
.default(false)
|
|
326
323
|
.description('发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!'),
|
|
327
|
-
dynamicCheckNumber: koishi_1.Schema.number()
|
|
328
|
-
.min(2)
|
|
329
|
-
.max(10)
|
|
330
|
-
.role('slider')
|
|
331
|
-
.step(1)
|
|
332
|
-
.default(5)
|
|
333
|
-
.description('设定每次检查动态的数量。若订阅的UP主经常在短时间内连着发多条动态可以将该值提高,若订阅的UP主有置顶动态,在计算该值时应+1。默认值为5条'),
|
|
334
324
|
dynamicLoopTime: koishi_1.Schema.union(['1分钟', '2分钟', '3分钟', '5分钟', '10分钟', '20分钟'])
|
|
335
325
|
.role('')
|
|
336
326
|
.default('2分钟')
|
|
@@ -352,12 +342,6 @@ exports.Config = koishi_1.Schema.object({
|
|
|
352
342
|
.step(0.5)
|
|
353
343
|
.default(1)
|
|
354
344
|
.description('设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时'),
|
|
355
|
-
danmakuPushTime: koishi_1.Schema.number()
|
|
356
|
-
.min(0)
|
|
357
|
-
.max(10)
|
|
358
|
-
.step(0.5)
|
|
359
|
-
.default(0.5)
|
|
360
|
-
.description('设定间隔多长时间推送一次弹幕消息,单位为分钟,默认为半分钟'),
|
|
361
345
|
customLiveStart: koishi_1.Schema.string()
|
|
362
346
|
.default('-name开播啦 -link')
|
|
363
347
|
.description('自定义开播提示语,-name代表UP昵称,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦'),
|
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": "3.0.0-alpha.
|
|
4
|
+
"version": "3.0.0-alpha.12",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Akokko <admin@akokko.com>"
|
|
7
7
|
],
|
|
@@ -30,14 +30,17 @@
|
|
|
30
30
|
"axios": "^1.7.9",
|
|
31
31
|
"axios-cookiejar-support": "^5.0.5",
|
|
32
32
|
"blive-message-listener": "^0.5.0",
|
|
33
|
+
"d3-cloud": "^1.2.7",
|
|
33
34
|
"jsdom": "^24.1.3",
|
|
34
35
|
"luxon": "^3.5.0",
|
|
35
36
|
"md5": "^2.3.0",
|
|
36
37
|
"qrcode": "^1.5.4",
|
|
38
|
+
"segmentit": "^2.0.3",
|
|
37
39
|
"tough-cookie": "^4.1.4"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@eslint/js": "^9.20.0",
|
|
43
|
+
"@types/d3-cloud": "^1",
|
|
41
44
|
"@types/luxon": "^3.4.2",
|
|
42
45
|
"@types/md5": "^2.3.5",
|
|
43
46
|
"@types/qrcode": "^1.5.5",
|
package/readme.md
CHANGED
|
@@ -222,6 +222,8 @@
|
|
|
222
222
|
- ver 3.0.0-alpha.8 修复:开播通知连续发送两次,登录后不会加载手动订阅中的订阅; 优化:网络请求报错
|
|
223
223
|
- ver 3.0.0-alpha.9 优化:加强直播推送对获取直播信息的错误处理
|
|
224
224
|
- ver 3.0.0-alpha.10 修复:连续推送两次开播通知
|
|
225
|
+
- ver 3.0.0-alpha.11 新增:直播结束后推送弹幕词云,直播推送上舰消息; 修复:直播推送都是同一张画面; 移除:直播推送弹幕消息
|
|
226
|
+
- ver 3.0.0-alpha.12 修复:上一版本无法安装
|
|
225
227
|
|
|
226
228
|
## 交流群
|
|
227
229
|
|