koishi-plugin-bilibili-notify 3.0.0-alpha.3 → 3.0.0-alpha.5
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.d.ts +2 -0
- package/lib/comRegister.js +128 -60
- package/lib/generateImg.js +1 -1
- package/lib/index.d.ts +12 -11
- package/lib/index.js +155 -147
- package/package.json +1 -1
- package/readme.md +2 -0
package/lib/comRegister.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ declare class ComRegister {
|
|
|
43
43
|
loginDBData: FlatPick<LoginBili, "dynamic_group_id">;
|
|
44
44
|
privateBot: Bot<Context>;
|
|
45
45
|
dynamicDispose: Function;
|
|
46
|
+
liveDispose: Function;
|
|
46
47
|
sendMsgFunc: (bot: Bot<Context, any>, channelId: string, content: any) => Promise<void>;
|
|
47
48
|
constructor(ctx: Context, config: ComRegister.Config);
|
|
48
49
|
init(config: ComRegister.Config): Promise<void>;
|
|
@@ -110,6 +111,7 @@ declare namespace ComRegister {
|
|
|
110
111
|
};
|
|
111
112
|
unlockSubLimits: boolean;
|
|
112
113
|
automaticResend: boolean;
|
|
114
|
+
liveDetectMode: 'API' | 'WS';
|
|
113
115
|
restartPush: boolean;
|
|
114
116
|
pushTime: number;
|
|
115
117
|
liveLoopTime: number;
|
package/lib/comRegister.js
CHANGED
|
@@ -42,8 +42,10 @@ class ComRegister {
|
|
|
42
42
|
loginDBData;
|
|
43
43
|
// 机器人实例
|
|
44
44
|
privateBot;
|
|
45
|
-
//
|
|
45
|
+
// 动态检测销毁函数
|
|
46
46
|
dynamicDispose;
|
|
47
|
+
// 直播检测销毁函数
|
|
48
|
+
liveDispose;
|
|
47
49
|
// 发送消息方式
|
|
48
50
|
sendMsgFunc;
|
|
49
51
|
// 构造函数
|
|
@@ -439,8 +441,21 @@ class ComRegister {
|
|
|
439
441
|
}
|
|
440
442
|
// 订阅直播
|
|
441
443
|
if (liveMsg) {
|
|
442
|
-
//
|
|
443
|
-
this.
|
|
444
|
+
// 判断直播订阅方式
|
|
445
|
+
switch (this.config.liveDetectMode) {
|
|
446
|
+
case "API": {
|
|
447
|
+
// 判断是否已开启直播检测
|
|
448
|
+
if (!this.liveDispose) { // 未开启直播检测
|
|
449
|
+
// 开启直播检测并保存销毁函数
|
|
450
|
+
this.liveDispose = await this.liveDetectWithAPI();
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
case "WS": {
|
|
455
|
+
// 连接到服务器
|
|
456
|
+
await this.liveDetectWithListener(roomId, target);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
444
459
|
// 发送订阅消息通知
|
|
445
460
|
await session.send(`订阅${userData.info.uname}直播通知`);
|
|
446
461
|
}
|
|
@@ -583,6 +598,14 @@ class ComRegister {
|
|
|
583
598
|
}
|
|
584
599
|
// 检查登录数据库是否有数据
|
|
585
600
|
this.loginDBData = (await this.ctx.database.get('loginBili', 1, ['dynamic_group_id']))[0];
|
|
601
|
+
// 判断登录信息是否已加载完毕
|
|
602
|
+
await this.checkIfLoginInfoIsLoaded();
|
|
603
|
+
// 如果未登录,则直接返回
|
|
604
|
+
if (!(await this.checkIfIsLogin())) {
|
|
605
|
+
// log
|
|
606
|
+
this.logger.info(`账号未登录,请登录`);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
586
609
|
// 从配置获取订阅
|
|
587
610
|
config.sub && await this.loadSubFromConfig(config.sub);
|
|
588
611
|
// 从数据库获取订阅
|
|
@@ -1156,21 +1179,13 @@ class ComRegister {
|
|
|
1156
1179
|
}
|
|
1157
1180
|
async liveDetectWithAPI() {
|
|
1158
1181
|
// 定义变量:第一次订阅
|
|
1159
|
-
let
|
|
1182
|
+
let liveDetectSetup = true;
|
|
1160
1183
|
// 定义变量:timer计时器
|
|
1161
1184
|
let timer = 0;
|
|
1162
1185
|
// 相当于锁的作用,防止上一个循环没处理完
|
|
1163
1186
|
let flag = true;
|
|
1164
1187
|
// 定义订阅对象Record 0未开播 1正在直播 2轮播中
|
|
1165
1188
|
const liveRecord = {};
|
|
1166
|
-
// 初始化subRecord
|
|
1167
|
-
this.subManager.forEach(sub => {
|
|
1168
|
-
// 判断是否订阅直播
|
|
1169
|
-
if (sub.live) {
|
|
1170
|
-
// 将该订阅添加到subRecord中
|
|
1171
|
-
liveRecord[sub.uid] = { liveStatus: 0, liveTime: '', target: sub.target };
|
|
1172
|
-
}
|
|
1173
|
-
});
|
|
1174
1189
|
// 定义函数: 发送请求获取直播状态
|
|
1175
1190
|
const useLiveStatus = async (roomId) => {
|
|
1176
1191
|
let content;
|
|
@@ -1202,10 +1217,18 @@ class ComRegister {
|
|
|
1202
1217
|
try {
|
|
1203
1218
|
// 获取正在直播对象
|
|
1204
1219
|
const liveUsers = await this.ctx.ba.getTheUserWhoIsLiveStreaming();
|
|
1205
|
-
//
|
|
1206
|
-
if (
|
|
1220
|
+
// 判断是否是初始化直播监测
|
|
1221
|
+
if (liveDetectSetup) {
|
|
1207
1222
|
// 将第一次订阅置为false
|
|
1208
|
-
|
|
1223
|
+
liveDetectSetup = false;
|
|
1224
|
+
// 初始化subRecord
|
|
1225
|
+
this.subManager.forEach(sub => {
|
|
1226
|
+
// 判断是否订阅直播
|
|
1227
|
+
if (sub.live) {
|
|
1228
|
+
// 将该订阅添加到subRecord中
|
|
1229
|
+
liveRecord[sub.uid] = { liveStatus: 0, liveTime: '', target: sub.target };
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1209
1232
|
// 先判断是否有UP主正在直播
|
|
1210
1233
|
if (liveUsers.count > 0) {
|
|
1211
1234
|
// 遍历liveUsers
|
|
@@ -1216,6 +1239,8 @@ class ComRegister {
|
|
|
1216
1239
|
const data = await useLiveStatus(item.room_id.toString());
|
|
1217
1240
|
// 设置开播时间
|
|
1218
1241
|
liveRecord[item.mid].liveTime = data.live_time;
|
|
1242
|
+
// 改变开播状态
|
|
1243
|
+
liveRecord[item.mid].liveStatus = 1;
|
|
1219
1244
|
// 设置直播中消息
|
|
1220
1245
|
const liveMsg = this.config.customLive ? this.config.customLive
|
|
1221
1246
|
.replace('-name', item.uname)
|
|
@@ -1229,8 +1254,6 @@ class ComRegister {
|
|
|
1229
1254
|
target: liveRecord[item.mid].target,
|
|
1230
1255
|
data
|
|
1231
1256
|
}, LiveType.LiveBroadcast, liveMsg);
|
|
1232
|
-
// 改变开播状态
|
|
1233
|
-
liveRecord[item.mid].liveStatus = 1;
|
|
1234
1257
|
}
|
|
1235
1258
|
});
|
|
1236
1259
|
}
|
|
@@ -1338,6 +1361,8 @@ class ComRegister {
|
|
|
1338
1361
|
const masterInfo = await this.useMasterInfo(subUID);
|
|
1339
1362
|
// 获取直播间消息
|
|
1340
1363
|
const liveRoomInfo = await this.useLiveRoomInfo(masterInfo.roomId.toString());
|
|
1364
|
+
// 设置开播时间
|
|
1365
|
+
liveRoomInfo.live_time = liveRecord[subUID].liveTime;
|
|
1341
1366
|
// 定义下播播通知语
|
|
1342
1367
|
const liveEndMsg = this.config.customLiveEnd ? this.config.customLiveEnd
|
|
1343
1368
|
.replace('-name', masterInfo.username)
|
|
@@ -1381,7 +1406,7 @@ class ComRegister {
|
|
|
1381
1406
|
const liveRoomInfo = await this.useLiveRoomInfo(roomId);
|
|
1382
1407
|
// 获取主播信息
|
|
1383
1408
|
const masterInfo = await this.useMasterInfo(liveRoomInfo.uid);
|
|
1384
|
-
//
|
|
1409
|
+
// 设置直播中消息
|
|
1385
1410
|
const liveMsg = this.config.customLive ? this.config.customLive
|
|
1386
1411
|
.replace('-name', masterInfo.username)
|
|
1387
1412
|
.replace('-time', await this.ctx.gi.getTimeDifference(liveTime))
|
|
@@ -1397,7 +1422,7 @@ class ComRegister {
|
|
|
1397
1422
|
// 定义弹幕推送函数
|
|
1398
1423
|
const danmakuPushFunc = () => {
|
|
1399
1424
|
// 判断数组是否有内容
|
|
1400
|
-
if (temporaryLiveDanmakuArr.length > 0) {
|
|
1425
|
+
if (danmakuPushTargetArr.length > 0 && temporaryLiveDanmakuArr.length > 0) {
|
|
1401
1426
|
// 发送消息
|
|
1402
1427
|
this.sendMsg(danmakuPushTargetArr, temporaryLiveDanmakuArr.join('\n'));
|
|
1403
1428
|
// 将临时消息数组清空
|
|
@@ -1441,45 +1466,49 @@ class ComRegister {
|
|
|
1441
1466
|
const liveRoomInfo = await this.useLiveRoomInfo(roomId);
|
|
1442
1467
|
// 获取主播信息
|
|
1443
1468
|
const masterInfo = await this.useMasterInfo(liveRoomInfo.uid);
|
|
1444
|
-
//
|
|
1445
|
-
|
|
1469
|
+
// 设置开播时间
|
|
1470
|
+
liveTime = liveRoomInfo.live_time;
|
|
1471
|
+
// 定义开播通知语
|
|
1472
|
+
const liveStartMsg = this.config.customLiveStart ? this.config.customLiveStart
|
|
1446
1473
|
.replace('-name', masterInfo.username)
|
|
1447
|
-
.replace('-time', await this.ctx.gi.getTimeDifference(liveTime))
|
|
1448
|
-
|
|
1449
|
-
liveRoomInfo.live_time = liveTime;
|
|
1474
|
+
.replace('-time', await this.ctx.gi.getTimeDifference(liveTime))
|
|
1475
|
+
.replace('-link', `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`) : null;
|
|
1450
1476
|
// 推送下播通知
|
|
1451
1477
|
await this.sendLiveNotifyCard({
|
|
1452
1478
|
username: masterInfo.username,
|
|
1453
1479
|
userface: masterInfo.userface,
|
|
1454
1480
|
target,
|
|
1455
1481
|
data: liveRoomInfo
|
|
1456
|
-
}, LiveType.
|
|
1482
|
+
}, LiveType.StartBroadcasting, liveStartMsg);
|
|
1483
|
+
// 开始直播,开启定时器
|
|
1484
|
+
pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1000 * 60 * 60);
|
|
1457
1485
|
},
|
|
1458
1486
|
onLiveEnd: async () => {
|
|
1459
1487
|
// 获取直播间消息
|
|
1460
1488
|
const liveRoomInfo = await this.useLiveRoomInfo(roomId);
|
|
1461
1489
|
// 获取主播信息
|
|
1462
1490
|
const masterInfo = await this.useMasterInfo(liveRoomInfo.uid);
|
|
1463
|
-
//
|
|
1464
|
-
|
|
1465
|
-
// 将推送定时器变量置空
|
|
1466
|
-
pushAtTimeTimer = null;
|
|
1491
|
+
// 更改直播时长
|
|
1492
|
+
liveRoomInfo.live_time = liveTime;
|
|
1467
1493
|
// 定义下播播通知语
|
|
1468
1494
|
const liveEndMsg = this.config.customLiveEnd ? this.config.customLiveEnd
|
|
1469
1495
|
.replace('-name', masterInfo.username)
|
|
1470
|
-
.replace('-time', await this.ctx.gi.getTimeDifference(liveTime))
|
|
1471
|
-
.replace('-link', `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`) : null;
|
|
1496
|
+
.replace('-time', await this.ctx.gi.getTimeDifference(liveTime)) : null;
|
|
1472
1497
|
// 推送通知卡片
|
|
1473
1498
|
await this.sendLiveNotifyCard({
|
|
1474
1499
|
username: masterInfo.username,
|
|
1475
1500
|
userface: masterInfo.userface,
|
|
1476
1501
|
target,
|
|
1477
1502
|
data: liveRoomInfo
|
|
1478
|
-
}, LiveType.
|
|
1503
|
+
}, LiveType.StopBroadcast, liveEndMsg);
|
|
1504
|
+
// 关闭定时推送定时器
|
|
1505
|
+
pushAtTimeTimer();
|
|
1506
|
+
// 将推送定时器变量置空
|
|
1507
|
+
pushAtTimeTimer = null;
|
|
1479
1508
|
}
|
|
1480
1509
|
};
|
|
1481
1510
|
// 启动直播间弹幕监测
|
|
1482
|
-
this.ctx.bl.startLiveRoomListener(roomId, handler, danmakuPushFunc);
|
|
1511
|
+
await this.ctx.bl.startLiveRoomListener(roomId, handler, danmakuPushFunc);
|
|
1483
1512
|
// 判断直播状态
|
|
1484
1513
|
if (liveRoomInfo.live_status === 1) {
|
|
1485
1514
|
// 设置开播时间
|
|
@@ -1701,8 +1730,21 @@ class ComRegister {
|
|
|
1701
1730
|
}
|
|
1702
1731
|
// 判断是否订阅直播
|
|
1703
1732
|
if (sub.live) {
|
|
1704
|
-
//
|
|
1705
|
-
this.
|
|
1733
|
+
// 判断直播订阅方式
|
|
1734
|
+
switch (this.config.liveDetectMode) {
|
|
1735
|
+
case "API": {
|
|
1736
|
+
// 判断是否已开启直播检测
|
|
1737
|
+
if (!this.liveDispose) { // 未开启直播检测
|
|
1738
|
+
// 开启直播检测并保存销毁函数
|
|
1739
|
+
this.liveDispose = await this.liveDetectWithAPI();
|
|
1740
|
+
}
|
|
1741
|
+
break;
|
|
1742
|
+
}
|
|
1743
|
+
case "WS": {
|
|
1744
|
+
// 连接到服务器
|
|
1745
|
+
await this.liveDetectWithListener(data.live_room.roomid, sub.target);
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1706
1748
|
}
|
|
1707
1749
|
}
|
|
1708
1750
|
// 在B站中订阅该对象
|
|
@@ -1723,17 +1765,6 @@ class ComRegister {
|
|
|
1723
1765
|
}
|
|
1724
1766
|
}
|
|
1725
1767
|
async loadSubFromDatabase() {
|
|
1726
|
-
// 判断登录信息是否已加载完毕
|
|
1727
|
-
await this.checkIfLoginInfoIsLoaded();
|
|
1728
|
-
// 如果未登录,则直接返回
|
|
1729
|
-
if (!(await this.checkIfIsLogin())) {
|
|
1730
|
-
// log
|
|
1731
|
-
this.logger.info(`账号未登录,请登录`);
|
|
1732
|
-
return;
|
|
1733
|
-
}
|
|
1734
|
-
// 已存在订阅管理对象,不再进行订阅操作
|
|
1735
|
-
if (this.subManager.length !== 0)
|
|
1736
|
-
return;
|
|
1737
1768
|
// 从数据库中获取数据
|
|
1738
1769
|
const subData = await this.ctx.database.get('bilibili', { id: { $gt: 0 } });
|
|
1739
1770
|
// 定义变量:订阅直播数
|
|
@@ -1836,20 +1867,33 @@ class ComRegister {
|
|
|
1836
1867
|
};
|
|
1837
1868
|
// 判断是否订阅直播
|
|
1838
1869
|
if (sub.live) {
|
|
1839
|
-
//
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1870
|
+
// 判断直播检测方式
|
|
1871
|
+
switch (this.config.liveDetectMode) {
|
|
1872
|
+
case "API": {
|
|
1873
|
+
// 判断是否已开启直播检测
|
|
1874
|
+
if (!this.liveDispose) { // 未开启直播检测
|
|
1875
|
+
// 开启直播检测并保存销毁函数
|
|
1876
|
+
this.liveDispose = await this.liveDetectWithAPI();
|
|
1877
|
+
}
|
|
1878
|
+
break;
|
|
1879
|
+
}
|
|
1880
|
+
case "WS": {
|
|
1881
|
+
// 判断订阅直播数是否超过限制
|
|
1882
|
+
if (!this.config.unlockSubLimits && liveSubNum >= 3) {
|
|
1883
|
+
// 将live改为false
|
|
1884
|
+
subManagerItem.live = false;
|
|
1885
|
+
// log
|
|
1886
|
+
this.logger.warn(`UID:${sub.uid} 订阅直播数超过限制,自动取消订阅`);
|
|
1887
|
+
// 发送错误消息
|
|
1888
|
+
await this.sendPrivateMsg(`UID:${sub.uid} 订阅直播数超过限制,自动取消订阅`);
|
|
1889
|
+
}
|
|
1890
|
+
else {
|
|
1891
|
+
// 直播订阅数+1
|
|
1892
|
+
liveSubNum++;
|
|
1893
|
+
// 订阅直播,开始循环检测
|
|
1894
|
+
this.liveDetectWithListener(sub.room_id, target);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1853
1897
|
}
|
|
1854
1898
|
}
|
|
1855
1899
|
// 保存新订阅对象
|
|
@@ -1900,6 +1944,17 @@ class ComRegister {
|
|
|
1900
1944
|
}
|
|
1901
1945
|
// 取消订阅
|
|
1902
1946
|
sub.live = false;
|
|
1947
|
+
// 判断直播检测方式
|
|
1948
|
+
switch (this.config.liveDetectMode) {
|
|
1949
|
+
case 'API': {
|
|
1950
|
+
msg = '请手动删除订阅,并重启插件';
|
|
1951
|
+
break;
|
|
1952
|
+
}
|
|
1953
|
+
case 'WS': {
|
|
1954
|
+
// 取消直播监听
|
|
1955
|
+
this.ctx.bl.closeListener(sub.roomId);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1903
1958
|
// 如果没有对这个UP的任何订阅,则移除
|
|
1904
1959
|
if (checkIfNoSubExist(sub)) {
|
|
1905
1960
|
// 从管理对象中移除
|
|
@@ -1958,6 +2013,15 @@ class ComRegister {
|
|
|
1958
2013
|
this.subManager.filter(sub => sub.uid === uid).map(async (sub, i) => {
|
|
1959
2014
|
// 判断是否还存在订阅了动态的对象,不存在则停止动态监测
|
|
1960
2015
|
this.checkIfUserIsTheLastOneWhoSubDyn();
|
|
2016
|
+
switch (this.config.liveDetectMode) {
|
|
2017
|
+
case "API": {
|
|
2018
|
+
break;
|
|
2019
|
+
}
|
|
2020
|
+
case "WS": {
|
|
2021
|
+
// 停止直播检测
|
|
2022
|
+
this.ctx.bl.closeListener(sub.roomId);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
1961
2025
|
// 从数据库中删除订阅
|
|
1962
2026
|
await this.ctx.database.remove('bilibili', { uid: this.subManager[i].uid });
|
|
1963
2027
|
// 将该订阅对象从订阅管理对象中移除
|
|
@@ -2005,6 +2069,10 @@ class ComRegister {
|
|
|
2005
2069
|
}),
|
|
2006
2070
|
unlockSubLimits: koishi_1.Schema.boolean().required(),
|
|
2007
2071
|
automaticResend: koishi_1.Schema.boolean().required(),
|
|
2072
|
+
liveDetectMode: koishi_1.Schema.union([
|
|
2073
|
+
koishi_1.Schema.const('API'),
|
|
2074
|
+
koishi_1.Schema.const('WS')
|
|
2075
|
+
]).required(),
|
|
2008
2076
|
restartPush: koishi_1.Schema.boolean().required(),
|
|
2009
2077
|
pushTime: koishi_1.Schema.number().required(),
|
|
2010
2078
|
liveLoopTime: koishi_1.Schema.number().default(10),
|
package/lib/generateImg.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -6,6 +6,17 @@ declare module 'koishi' {
|
|
|
6
6
|
sm: ServerManager;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
declare class ServerManager extends Service {
|
|
10
|
+
servers: ForkScope[];
|
|
11
|
+
renderType: number;
|
|
12
|
+
dynamicLoopTime: number;
|
|
13
|
+
constructor(ctx: Context);
|
|
14
|
+
protected start(): void | Promise<void>;
|
|
15
|
+
registerPlugin: () => boolean;
|
|
16
|
+
disposePlugin: () => Promise<boolean>;
|
|
17
|
+
restartPlugin: () => Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
export declare function apply(ctx: Context, config: Config): void;
|
|
9
20
|
export interface Config {
|
|
10
21
|
require: {};
|
|
11
22
|
key: string;
|
|
@@ -36,6 +47,7 @@ export interface Config {
|
|
|
36
47
|
dynamicCheckNumber: number;
|
|
37
48
|
dynamicLoopTime: '1分钟' | '2分钟' | '3分钟' | '5分钟' | '10分钟' | '20分钟';
|
|
38
49
|
live: {};
|
|
50
|
+
liveDetectMode: 'API' | 'WS';
|
|
39
51
|
restartPush: boolean;
|
|
40
52
|
pushTime: number;
|
|
41
53
|
danmakuPushTime: number;
|
|
@@ -54,15 +66,4 @@ export interface Config {
|
|
|
54
66
|
dynamicDebugMode: boolean;
|
|
55
67
|
}
|
|
56
68
|
export declare const Config: Schema<Config>;
|
|
57
|
-
declare class ServerManager extends Service {
|
|
58
|
-
servers: ForkScope[];
|
|
59
|
-
renderType: number;
|
|
60
|
-
dynamicLoopTime: number;
|
|
61
|
-
constructor(ctx: Context);
|
|
62
|
-
protected start(): void | Promise<void>;
|
|
63
|
-
registerPlugin: () => boolean;
|
|
64
|
-
disposePlugin: () => Promise<boolean>;
|
|
65
|
-
restartPlugin: () => Promise<boolean>;
|
|
66
|
-
}
|
|
67
|
-
export declare function apply(ctx: Context, config: Config): void;
|
|
68
69
|
export {};
|
package/lib/index.js
CHANGED
|
@@ -51,153 +51,6 @@ const blive_1 = __importDefault(require("./blive"));
|
|
|
51
51
|
exports.inject = ['puppeteer', 'database', 'notifier'];
|
|
52
52
|
exports.name = 'bilibili-notify';
|
|
53
53
|
let globalConfig;
|
|
54
|
-
exports.Config = koishi_1.Schema.object({
|
|
55
|
-
require: koishi_1.Schema.object({}).description('必填设置'),
|
|
56
|
-
key: koishi_1.Schema.string()
|
|
57
|
-
.pattern(/^[0-9a-f]{32}$/)
|
|
58
|
-
.role('secret')
|
|
59
|
-
.required()
|
|
60
|
-
.description('请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/'),
|
|
61
|
-
master: koishi_1.Schema.intersect([
|
|
62
|
-
koishi_1.Schema.object({
|
|
63
|
-
enable: koishi_1.Schema.boolean()
|
|
64
|
-
.default(false)
|
|
65
|
-
.description('是否开启主人账号功能,如果您的机器人没有私聊权限请不要开启此功能。开启后如果机器人运行错误会向您进行报告')
|
|
66
|
-
}).description('主人账号'),
|
|
67
|
-
koishi_1.Schema.union([
|
|
68
|
-
koishi_1.Schema.object({
|
|
69
|
-
enable: koishi_1.Schema.const(true).required(),
|
|
70
|
-
platform: koishi_1.Schema.union(['qq', 'qqguild', 'onebot', 'discord', 'red', 'telegram', 'satori', 'chronocat', 'lark'])
|
|
71
|
-
.description('请选择您的私人机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件'),
|
|
72
|
-
masterAccount: koishi_1.Schema.string()
|
|
73
|
-
.role('secret')
|
|
74
|
-
.required()
|
|
75
|
-
.description('主人账号,在Q群使用可直接使用QQ号,若在其他平台使用,请使用inspect插件获取自身ID'),
|
|
76
|
-
masterAccountGuildId: koishi_1.Schema.string()
|
|
77
|
-
.role('secret')
|
|
78
|
-
.description('主人账号所在的群组ID,只有在QQ频道、Discord这样的环境才需要填写,请使用inspect插件获取群组ID'),
|
|
79
|
-
}),
|
|
80
|
-
koishi_1.Schema.object({})
|
|
81
|
-
])
|
|
82
|
-
]),
|
|
83
|
-
basicSettings: koishi_1.Schema.object({}).description('基本设置'),
|
|
84
|
-
unlockSubLimits: koishi_1.Schema.boolean()
|
|
85
|
-
.default(false)
|
|
86
|
-
.description('解锁3个直播订阅限制,默认只允许订阅3位UP主。订阅过多用户可能有导致IP暂时被封禁的风险'),
|
|
87
|
-
automaticResend: koishi_1.Schema.boolean()
|
|
88
|
-
.default(true)
|
|
89
|
-
.description('是否开启自动重发功能,默认开启。开启后,如果推送失败,将会自动重发,尝试三次。关闭后,推送失败将不会再重发,直到下一次推送'),
|
|
90
|
-
renderType: koishi_1.Schema.union(['render', 'page'])
|
|
91
|
-
.role('')
|
|
92
|
-
.default('render')
|
|
93
|
-
.description('渲染类型,默认为render模式,渲染速度更快,但会出现乱码问题,若出现乱码问题,请切换到page模式。若使用自定义字体,建议选择render模式'),
|
|
94
|
-
userAgent: koishi_1.Schema.string()
|
|
95
|
-
.required()
|
|
96
|
-
.description('设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111'),
|
|
97
|
-
subTitle: koishi_1.Schema.object({}).description('手动订阅'),
|
|
98
|
-
sub: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
99
|
-
uid: koishi_1.Schema.string().description('订阅用户UID'),
|
|
100
|
-
dynamic: koishi_1.Schema.boolean().description('是否订阅用户动态'),
|
|
101
|
-
live: koishi_1.Schema.boolean().description('是否订阅用户直播'),
|
|
102
|
-
target: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
103
|
-
channelIdArr: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
104
|
-
channelId: koishi_1.Schema.string().description('频道/群组号'),
|
|
105
|
-
dynamic: koishi_1.Schema.boolean().description('该频道/群组是否推送动态信息'),
|
|
106
|
-
live: koishi_1.Schema.boolean().description('该频道/群组是否推送直播通知'),
|
|
107
|
-
liveDanmaku: koishi_1.Schema.boolean().description('该频道/群组是否推送弹幕消息'),
|
|
108
|
-
atAll: koishi_1.Schema.boolean().description('推送开播通知时是否艾特全体成员')
|
|
109
|
-
})).description('频道/群组信息'),
|
|
110
|
-
platform: koishi_1.Schema.string().description('推送平台')
|
|
111
|
-
})).description('订阅用户需要发送的频道/群组信息')
|
|
112
|
-
})).role('table').description('手动输入订阅信息,方便自定义订阅内容,这里的订阅内容不会存入数据库。uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播'),
|
|
113
|
-
dynamic: koishi_1.Schema.object({}).description('动态推送设置'),
|
|
114
|
-
dynamicUrl: koishi_1.Schema.boolean()
|
|
115
|
-
.default(false)
|
|
116
|
-
.description('发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!'),
|
|
117
|
-
dynamicCheckNumber: koishi_1.Schema.number()
|
|
118
|
-
.min(2)
|
|
119
|
-
.max(10)
|
|
120
|
-
.role('slider')
|
|
121
|
-
.step(1)
|
|
122
|
-
.default(5)
|
|
123
|
-
.description('设定每次检查动态的数量。若订阅的UP主经常在短时间内连着发多条动态可以将该值提高,若订阅的UP主有置顶动态,在计算该值时应+1。默认值为5条'),
|
|
124
|
-
dynamicLoopTime: koishi_1.Schema.union(['1分钟', '2分钟', '3分钟', '5分钟', '10分钟', '20分钟'])
|
|
125
|
-
.role('')
|
|
126
|
-
.default('2分钟')
|
|
127
|
-
.description('设定多久检测一次动态。若需动态的时效性,可以设置为1分钟。若订阅的UP主经常在短时间内连着发多条动态应该将该值提高,否则会出现动态漏推送和晚推送的问题,默认值为2分钟'),
|
|
128
|
-
live: koishi_1.Schema.object({}).description('直播推送设置'),
|
|
129
|
-
restartPush: koishi_1.Schema.boolean()
|
|
130
|
-
.default(true)
|
|
131
|
-
.description('插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启'),
|
|
132
|
-
pushTime: koishi_1.Schema.number()
|
|
133
|
-
.min(0)
|
|
134
|
-
.max(12)
|
|
135
|
-
.step(0.5)
|
|
136
|
-
.default(1)
|
|
137
|
-
.description('设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时'),
|
|
138
|
-
danmakuPushTime: koishi_1.Schema.number()
|
|
139
|
-
.min(0)
|
|
140
|
-
.max(10)
|
|
141
|
-
.step(0.5)
|
|
142
|
-
.default(0.5)
|
|
143
|
-
.description('设定间隔多长时间推送一次弹幕消息,单位为分钟,默认为半分钟'),
|
|
144
|
-
customLiveStart: koishi_1.Schema.string()
|
|
145
|
-
.default('-name开播啦 -link')
|
|
146
|
-
.description('自定义开播提示语,-name代表UP昵称,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦'),
|
|
147
|
-
customLive: koishi_1.Schema.string()
|
|
148
|
-
.description('自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx'),
|
|
149
|
-
customLiveEnd: koishi_1.Schema.string()
|
|
150
|
-
.default('-name下播啦,本次直播了-time')
|
|
151
|
-
.description('自定义下播提示语,-name代表UP昵称,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒'),
|
|
152
|
-
hideDesc: koishi_1.Schema.boolean()
|
|
153
|
-
.default(false)
|
|
154
|
-
.description('是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介'),
|
|
155
|
-
style: koishi_1.Schema.object({}).description('美化设置'),
|
|
156
|
-
removeBorder: koishi_1.Schema.boolean()
|
|
157
|
-
.default(false)
|
|
158
|
-
.description('移除推送卡片边框'),
|
|
159
|
-
cardColorStart: koishi_1.Schema.string()
|
|
160
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
161
|
-
.default('#F38AB5')
|
|
162
|
-
.description('推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/'),
|
|
163
|
-
cardColorEnd: koishi_1.Schema.string()
|
|
164
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
165
|
-
.default('#F9CCDF')
|
|
166
|
-
.description('推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/'),
|
|
167
|
-
enableLargeFont: koishi_1.Schema.boolean()
|
|
168
|
-
.default(false)
|
|
169
|
-
.description('是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看'),
|
|
170
|
-
font: koishi_1.Schema.string()
|
|
171
|
-
.description('推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei'),
|
|
172
|
-
filter: koishi_1.Schema.intersect([
|
|
173
|
-
koishi_1.Schema.object({
|
|
174
|
-
enable: koishi_1.Schema.boolean()
|
|
175
|
-
.default(false)
|
|
176
|
-
.description('是否开启动态屏蔽功能')
|
|
177
|
-
}).description('屏蔽设置'),
|
|
178
|
-
koishi_1.Schema.union([
|
|
179
|
-
koishi_1.Schema.object({
|
|
180
|
-
enable: koishi_1.Schema.const(true).required().experimental(),
|
|
181
|
-
notify: koishi_1.Schema.boolean()
|
|
182
|
-
.default(false)
|
|
183
|
-
.description('动态被屏蔽是否发送提示'),
|
|
184
|
-
regex: koishi_1.Schema.string()
|
|
185
|
-
.description('正则表达式屏蔽'),
|
|
186
|
-
keywords: koishi_1.Schema.array(String)
|
|
187
|
-
.description('关键字屏蔽,一个关键字为一项'),
|
|
188
|
-
forward: koishi_1.Schema.boolean()
|
|
189
|
-
.default(false)
|
|
190
|
-
.description("是否屏蔽转发动态"),
|
|
191
|
-
}),
|
|
192
|
-
koishi_1.Schema.object({})
|
|
193
|
-
])
|
|
194
|
-
]),
|
|
195
|
-
debug: koishi_1.Schema.object({}).description('调试设置'),
|
|
196
|
-
dynamicDebugMode: koishi_1.Schema.boolean()
|
|
197
|
-
.default(false)
|
|
198
|
-
.description('动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试')
|
|
199
|
-
.experimental()
|
|
200
|
-
});
|
|
201
54
|
class ServerManager extends koishi_1.Service {
|
|
202
55
|
// 服务
|
|
203
56
|
servers = [];
|
|
@@ -311,6 +164,7 @@ class ServerManager extends koishi_1.Service {
|
|
|
311
164
|
master: globalConfig.master,
|
|
312
165
|
unlockSubLimits: globalConfig.unlockSubLimits,
|
|
313
166
|
automaticResend: globalConfig.automaticResend,
|
|
167
|
+
liveDetectMode: globalConfig.liveDetectMode,
|
|
314
168
|
restartPush: globalConfig.restartPush,
|
|
315
169
|
pushTime: globalConfig.pushTime,
|
|
316
170
|
customLiveStart: globalConfig.customLiveStart,
|
|
@@ -407,3 +261,157 @@ function apply(ctx, config) {
|
|
|
407
261
|
}
|
|
408
262
|
});
|
|
409
263
|
}
|
|
264
|
+
exports.Config = koishi_1.Schema.object({
|
|
265
|
+
require: koishi_1.Schema.object({}).description('必填设置'),
|
|
266
|
+
key: koishi_1.Schema.string()
|
|
267
|
+
.pattern(/^[0-9a-f]{32}$/)
|
|
268
|
+
.role('secret')
|
|
269
|
+
.required()
|
|
270
|
+
.description('请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/'),
|
|
271
|
+
master: koishi_1.Schema.intersect([
|
|
272
|
+
koishi_1.Schema.object({
|
|
273
|
+
enable: koishi_1.Schema.boolean()
|
|
274
|
+
.default(false)
|
|
275
|
+
.description('是否开启主人账号功能,如果您的机器人没有私聊权限请不要开启此功能。开启后如果机器人运行错误会向您进行报告')
|
|
276
|
+
}).description('主人账号'),
|
|
277
|
+
koishi_1.Schema.union([
|
|
278
|
+
koishi_1.Schema.object({
|
|
279
|
+
enable: koishi_1.Schema.const(true).required(),
|
|
280
|
+
platform: koishi_1.Schema.union(['qq', 'qqguild', 'onebot', 'discord', 'red', 'telegram', 'satori', 'chronocat', 'lark'])
|
|
281
|
+
.description('请选择您的私人机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件'),
|
|
282
|
+
masterAccount: koishi_1.Schema.string()
|
|
283
|
+
.role('secret')
|
|
284
|
+
.required()
|
|
285
|
+
.description('主人账号,在Q群使用可直接使用QQ号,若在其他平台使用,请使用inspect插件获取自身ID'),
|
|
286
|
+
masterAccountGuildId: koishi_1.Schema.string()
|
|
287
|
+
.role('secret')
|
|
288
|
+
.description('主人账号所在的群组ID,只有在QQ频道、Discord这样的环境才需要填写,请使用inspect插件获取群组ID'),
|
|
289
|
+
}),
|
|
290
|
+
koishi_1.Schema.object({})
|
|
291
|
+
])
|
|
292
|
+
]),
|
|
293
|
+
basicSettings: koishi_1.Schema.object({}).description('基本设置'),
|
|
294
|
+
unlockSubLimits: koishi_1.Schema.boolean()
|
|
295
|
+
.default(false)
|
|
296
|
+
.description('解锁3个直播订阅限制,默认只允许订阅3位UP主。订阅过多用户可能有导致IP暂时被封禁的风险'),
|
|
297
|
+
automaticResend: koishi_1.Schema.boolean()
|
|
298
|
+
.default(true)
|
|
299
|
+
.description('是否开启自动重发功能,默认开启。开启后,如果推送失败,将会自动重发,尝试三次。关闭后,推送失败将不会再重发,直到下一次推送'),
|
|
300
|
+
renderType: koishi_1.Schema.union(['render', 'page'])
|
|
301
|
+
.role('')
|
|
302
|
+
.default('render')
|
|
303
|
+
.description('渲染类型,默认为render模式,渲染速度更快,但会出现乱码问题,若出现乱码问题,请切换到page模式。若使用自定义字体,建议选择render模式'),
|
|
304
|
+
userAgent: koishi_1.Schema.string()
|
|
305
|
+
.required()
|
|
306
|
+
.description('设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111'),
|
|
307
|
+
subTitle: koishi_1.Schema.object({}).description('手动订阅'),
|
|
308
|
+
sub: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
309
|
+
uid: koishi_1.Schema.string().description('订阅用户UID'),
|
|
310
|
+
dynamic: koishi_1.Schema.boolean().description('是否订阅用户动态'),
|
|
311
|
+
live: koishi_1.Schema.boolean().description('是否订阅用户直播'),
|
|
312
|
+
target: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
313
|
+
channelIdArr: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
314
|
+
channelId: koishi_1.Schema.string().description('频道/群组号'),
|
|
315
|
+
dynamic: koishi_1.Schema.boolean().description('该频道/群组是否推送动态信息'),
|
|
316
|
+
live: koishi_1.Schema.boolean().description('该频道/群组是否推送直播通知'),
|
|
317
|
+
liveDanmaku: koishi_1.Schema.boolean().description('该频道/群组是否推送弹幕消息'),
|
|
318
|
+
atAll: koishi_1.Schema.boolean().description('推送开播通知时是否艾特全体成员')
|
|
319
|
+
})).description('频道/群组信息'),
|
|
320
|
+
platform: koishi_1.Schema.string().description('推送平台')
|
|
321
|
+
})).description('订阅用户需要发送的频道/群组信息')
|
|
322
|
+
})).role('table').description('手动输入订阅信息,方便自定义订阅内容,这里的订阅内容不会存入数据库。uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播'),
|
|
323
|
+
dynamic: koishi_1.Schema.object({}).description('动态推送设置'),
|
|
324
|
+
dynamicUrl: koishi_1.Schema.boolean()
|
|
325
|
+
.default(false)
|
|
326
|
+
.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
|
+
dynamicLoopTime: koishi_1.Schema.union(['1分钟', '2分钟', '3分钟', '5分钟', '10分钟', '20分钟'])
|
|
335
|
+
.role('')
|
|
336
|
+
.default('2分钟')
|
|
337
|
+
.description('设定多久检测一次动态。若需动态的时效性,可以设置为1分钟。若订阅的UP主经常在短时间内连着发多条动态应该将该值提高,否则会出现动态漏推送和晚推送的问题,默认值为2分钟'),
|
|
338
|
+
live: koishi_1.Schema.object({}).description('直播推送设置'),
|
|
339
|
+
liveDetectMode: koishi_1.Schema.union([
|
|
340
|
+
koishi_1.Schema.const('WS').description('WebSocket模式:连接到对应的直播间,可推送弹幕消息,开播下播响应最快,但对订阅数有限制'),
|
|
341
|
+
koishi_1.Schema.const('API').description('API模式:请求对应直播间API,无法获取弹幕消息,开播下播响应慢,理论可无限订阅').experimental()
|
|
342
|
+
])
|
|
343
|
+
.role('radio')
|
|
344
|
+
.description('直播检测模式')
|
|
345
|
+
.default('WS'),
|
|
346
|
+
restartPush: koishi_1.Schema.boolean()
|
|
347
|
+
.default(true)
|
|
348
|
+
.description('插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启'),
|
|
349
|
+
pushTime: koishi_1.Schema.number()
|
|
350
|
+
.min(0)
|
|
351
|
+
.max(12)
|
|
352
|
+
.step(0.5)
|
|
353
|
+
.default(1)
|
|
354
|
+
.description('设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时'),
|
|
355
|
+
danmakuPushTime: koishi_1.Schema.number()
|
|
356
|
+
.min(0)
|
|
357
|
+
.max(10)
|
|
358
|
+
.step(0.5)
|
|
359
|
+
.default(0.5)
|
|
360
|
+
.description('设定间隔多长时间推送一次弹幕消息,单位为分钟,默认为半分钟'),
|
|
361
|
+
customLiveStart: koishi_1.Schema.string()
|
|
362
|
+
.default('-name开播啦 -link')
|
|
363
|
+
.description('自定义开播提示语,-name代表UP昵称,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦'),
|
|
364
|
+
customLive: koishi_1.Schema.string()
|
|
365
|
+
.description('自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx'),
|
|
366
|
+
customLiveEnd: koishi_1.Schema.string()
|
|
367
|
+
.default('-name下播啦,本次直播了-time')
|
|
368
|
+
.description('自定义下播提示语,-name代表UP昵称,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒'),
|
|
369
|
+
hideDesc: koishi_1.Schema.boolean()
|
|
370
|
+
.default(false)
|
|
371
|
+
.description('是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介'),
|
|
372
|
+
style: koishi_1.Schema.object({}).description('美化设置'),
|
|
373
|
+
removeBorder: koishi_1.Schema.boolean()
|
|
374
|
+
.default(false)
|
|
375
|
+
.description('移除推送卡片边框'),
|
|
376
|
+
cardColorStart: koishi_1.Schema.string()
|
|
377
|
+
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
378
|
+
.default('#F38AB5')
|
|
379
|
+
.description('推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/'),
|
|
380
|
+
cardColorEnd: koishi_1.Schema.string()
|
|
381
|
+
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
382
|
+
.default('#F9CCDF')
|
|
383
|
+
.description('推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/'),
|
|
384
|
+
enableLargeFont: koishi_1.Schema.boolean()
|
|
385
|
+
.default(false)
|
|
386
|
+
.description('是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看'),
|
|
387
|
+
font: koishi_1.Schema.string()
|
|
388
|
+
.description('推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei'),
|
|
389
|
+
filter: koishi_1.Schema.intersect([
|
|
390
|
+
koishi_1.Schema.object({
|
|
391
|
+
enable: koishi_1.Schema.boolean()
|
|
392
|
+
.default(false)
|
|
393
|
+
.description('是否开启动态屏蔽功能')
|
|
394
|
+
}).description('屏蔽设置'),
|
|
395
|
+
koishi_1.Schema.union([
|
|
396
|
+
koishi_1.Schema.object({
|
|
397
|
+
enable: koishi_1.Schema.const(true).required().experimental(),
|
|
398
|
+
notify: koishi_1.Schema.boolean()
|
|
399
|
+
.default(false)
|
|
400
|
+
.description('动态被屏蔽是否发送提示'),
|
|
401
|
+
regex: koishi_1.Schema.string()
|
|
402
|
+
.description('正则表达式屏蔽'),
|
|
403
|
+
keywords: koishi_1.Schema.array(String)
|
|
404
|
+
.description('关键字屏蔽,一个关键字为一项'),
|
|
405
|
+
forward: koishi_1.Schema.boolean()
|
|
406
|
+
.default(false)
|
|
407
|
+
.description("是否屏蔽转发动态"),
|
|
408
|
+
}),
|
|
409
|
+
koishi_1.Schema.object({})
|
|
410
|
+
])
|
|
411
|
+
]),
|
|
412
|
+
debug: koishi_1.Schema.object({}).description('调试设置'),
|
|
413
|
+
dynamicDebugMode: koishi_1.Schema.boolean()
|
|
414
|
+
.default(false)
|
|
415
|
+
.description('动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试')
|
|
416
|
+
.experimental()
|
|
417
|
+
});
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -215,6 +215,8 @@
|
|
|
215
215
|
- ver 3.0.0-alpha.1 测试版本
|
|
216
216
|
- ver 3.0.0-alpha.2 修复:只订阅直播也会将该UP主的动态进行推送、推送过的动态过一段时间又会再次推送
|
|
217
217
|
- ver 3.0.0-alpha.3 修复:未开启弹幕推送也不会推送直播通知卡片
|
|
218
|
+
- ver 3.0.0-alpha.4 修复:使用了手动订阅,数据库中的订阅不会加载
|
|
219
|
+
- ver 3.0.0-alpha.5 修复:订阅的直播开播后,未开启弹幕推送会一直报错、主播开播推送下播卡片,直播时长显示NaN; 新增:直播检测模式选项; 优化:下播卡片内容
|
|
218
220
|
|
|
219
221
|
## 交流群
|
|
220
222
|
|