koishi-plugin-bilibili-notify 3.2.0-alpha.1 → 3.2.0-alpha.3
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 +36 -10
- package/package.json +1 -1
- package/readme.md +3 -1
package/lib/comRegister.js
CHANGED
|
@@ -978,7 +978,9 @@ class ComRegister {
|
|
|
978
978
|
// 判断是否信息是否获取成功
|
|
979
979
|
if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.LiveBroadcast))) {
|
|
980
980
|
// 未获取成功,直接返回
|
|
981
|
-
|
|
981
|
+
await this.sendPrivateMsg("获取直播间信息失败,推送直播卡片失败!");
|
|
982
|
+
// 停止服务
|
|
983
|
+
return await this.sendPrivateMsgAndStopService();
|
|
982
984
|
}
|
|
983
985
|
// 判断是否已经下播
|
|
984
986
|
if (liveRoomInfo.live_status === 0) {
|
|
@@ -1069,7 +1071,9 @@ class ComRegister {
|
|
|
1069
1071
|
// 设置开播状态为false
|
|
1070
1072
|
liveStatus = false;
|
|
1071
1073
|
// 未获取成功,直接返回
|
|
1072
|
-
|
|
1074
|
+
await this.sendPrivateMsg("获取直播间信息失败,推送直播开播卡片失败!");
|
|
1075
|
+
// 停止服务
|
|
1076
|
+
return await this.sendPrivateMsgAndStopService();
|
|
1073
1077
|
}
|
|
1074
1078
|
// 设置开播时间
|
|
1075
1079
|
liveTime = liveRoomInfo.live_time;
|
|
@@ -1104,7 +1108,9 @@ class ComRegister {
|
|
|
1104
1108
|
// 判断是否信息是否获取成功
|
|
1105
1109
|
if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.StopBroadcast))) {
|
|
1106
1110
|
// 未获取成功,直接返回
|
|
1107
|
-
|
|
1111
|
+
await this.sendPrivateMsg("获取直播间信息失败,推送直播下播卡片失败!");
|
|
1112
|
+
// 停止服务
|
|
1113
|
+
return await this.sendPrivateMsgAndStopService();
|
|
1108
1114
|
}
|
|
1109
1115
|
// 更改直播时长
|
|
1110
1116
|
liveRoomInfo.live_time = liveTime;
|
|
@@ -1216,9 +1222,23 @@ class ComRegister {
|
|
|
1216
1222
|
for (const [uid] of this.liveStatusManager.entries()) {
|
|
1217
1223
|
uids.push(uid);
|
|
1218
1224
|
}
|
|
1225
|
+
const useLiveInfo = async () => {
|
|
1226
|
+
// 发送请求
|
|
1227
|
+
const { data } = await (0, utils_1.withRetry)(async () => (await this.ctx.ba.getLiveRoomInfoByUids(uids)), 3).catch(async () => {
|
|
1228
|
+
// 返回undefined
|
|
1229
|
+
return undefined;
|
|
1230
|
+
});
|
|
1231
|
+
if (!data) {
|
|
1232
|
+
// 停止服务
|
|
1233
|
+
await this.sendPrivateMsgAndStopService();
|
|
1234
|
+
// 返回
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
return data;
|
|
1238
|
+
};
|
|
1239
|
+
// 获取信息
|
|
1240
|
+
const data = await useLiveInfo();
|
|
1219
1241
|
// 初始化
|
|
1220
|
-
// 发送请求
|
|
1221
|
-
const { data } = (await this.ctx.ba.getLiveRoomInfoByUids(uids));
|
|
1222
1242
|
for (const item of Object.values(data)) {
|
|
1223
1243
|
// 将用户uid转换为string
|
|
1224
1244
|
const uid = item.uid.toString();
|
|
@@ -1259,7 +1279,7 @@ class ComRegister {
|
|
|
1259
1279
|
// 定义函数
|
|
1260
1280
|
const handler = async () => {
|
|
1261
1281
|
// 发送请求
|
|
1262
|
-
const
|
|
1282
|
+
const data = await useLiveInfo();
|
|
1263
1283
|
// 进行处理
|
|
1264
1284
|
for (const item of Object.values(data)) {
|
|
1265
1285
|
// 将用户uid转换为string
|
|
@@ -1281,7 +1301,9 @@ class ComRegister {
|
|
|
1281
1301
|
// 判断信息是否获取成功
|
|
1282
1302
|
if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.StopBroadcast, liveStatus))) {
|
|
1283
1303
|
// 未获取成功,直接返回
|
|
1284
|
-
|
|
1304
|
+
await this.sendPrivateMsg("获取直播间信息失败,推送直播下播卡片失败!");
|
|
1305
|
+
// 停止服务
|
|
1306
|
+
return await this.sendPrivateMsgAndStopService();
|
|
1285
1307
|
}
|
|
1286
1308
|
// 更改直播时长
|
|
1287
1309
|
if (liveStatus.liveStartTimeInit) {
|
|
@@ -1333,7 +1355,9 @@ class ComRegister {
|
|
|
1333
1355
|
// 判断信息是否获取成功
|
|
1334
1356
|
if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.StopBroadcast, liveStatus))) {
|
|
1335
1357
|
// 未获取成功,直接返回
|
|
1336
|
-
|
|
1358
|
+
await this.sendPrivateMsg("获取直播间信息失败,推送直播开播卡片失败!");
|
|
1359
|
+
// 停止服务
|
|
1360
|
+
return await this.sendPrivateMsgAndStopService();
|
|
1337
1361
|
}
|
|
1338
1362
|
// 设置开播时间
|
|
1339
1363
|
liveStatus.liveStartTime = liveStatus.liveRoomInfo.live_time;
|
|
@@ -1372,7 +1396,9 @@ class ComRegister {
|
|
|
1372
1396
|
// 判断是否信息是否获取成功
|
|
1373
1397
|
if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.LiveBroadcast, liveStatus))) {
|
|
1374
1398
|
// 未获取成功,直接返回
|
|
1375
|
-
|
|
1399
|
+
await this.sendPrivateMsg("获取直播间信息失败,推送直播卡片失败!");
|
|
1400
|
+
// 停止服务
|
|
1401
|
+
return await this.sendPrivateMsgAndStopService();
|
|
1376
1402
|
}
|
|
1377
1403
|
// 判断是否需要设置开播时间
|
|
1378
1404
|
if (!liveStatus.liveStartTimeInit) {
|
|
@@ -1713,7 +1739,7 @@ class ComRegister {
|
|
|
1713
1739
|
}
|
|
1714
1740
|
async enableLiveDetect() {
|
|
1715
1741
|
// 定义Job
|
|
1716
|
-
this.liveJob = new cron_1.CronJob("*/
|
|
1742
|
+
this.liveJob = new cron_1.CronJob("*/20 * * * * *", await this.liveDetectWithAPI());
|
|
1717
1743
|
// logger
|
|
1718
1744
|
this.logger.info("直播监测已开启");
|
|
1719
1745
|
// 开始直播监测
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -249,7 +249,9 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
|
|
|
249
249
|
- ver 3.1.7-alpha.3 修复:推送视频类动态报错;
|
|
250
250
|
- ver 3.1.7 修复:第一次使用插件报错 `TypeError: Cannot read properties of undefined (reading 'dynamic_group_id')`
|
|
251
251
|
- ver 3.2.0-alpha.0 新增:直播检测 `API` 模式; 优化:提升直播检测 `WS` 模式使用体验;
|
|
252
|
-
- ver 3.2.0-alpha.1 修复:直播检测 `API` 模式,中途加入推送语无法正确显示直播时长;
|
|
252
|
+
- ver 3.2.0-alpha.1 修复:直播检测 `API` 模式,中途加入推送语无法正确显示直播时长;
|
|
253
|
+
- ver 3.2.0-alpha.2 修复:直播检测 `API` 模式,请求错误优化(防止不停向QQ发送消息);
|
|
254
|
+
- ver 3.2.0-alpha.3 优化:增加直播检测 `API` 模式轮询时间,防止被暂时风控;
|
|
253
255
|
|
|
254
256
|
## 交流群
|
|
255
257
|
|