koishi-plugin-bilibili-notify 3.2.2 → 3.2.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/blive.js +4 -3
- package/lib/comRegister.js +0 -29
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/blive.js
CHANGED
|
@@ -32,13 +32,14 @@ class BLive extends koishi_1.Service {
|
|
|
32
32
|
uid: mySelfInfo.data.mid,
|
|
33
33
|
},
|
|
34
34
|
});
|
|
35
|
+
this.logger.info(`[${roomId}]直播间连接已建立!`);
|
|
35
36
|
}
|
|
36
37
|
closeListener(roomId) {
|
|
37
38
|
// 判断直播间监听器是否关闭
|
|
38
39
|
if (!this.listenerRecord ||
|
|
39
40
|
!this.listenerRecord[roomId]?.closed) {
|
|
40
41
|
// 输出logger
|
|
41
|
-
this.logger.info(`${roomId}
|
|
42
|
+
this.logger.info(`${roomId}直播间连接无需关闭`);
|
|
42
43
|
}
|
|
43
44
|
// 关闭直播间监听器
|
|
44
45
|
this.listenerRecord[roomId].close();
|
|
@@ -47,12 +48,12 @@ class BLive extends koishi_1.Service {
|
|
|
47
48
|
// 删除直播间监听器
|
|
48
49
|
delete this.listenerRecord[roomId];
|
|
49
50
|
// 输出logger
|
|
50
|
-
this.logger.info(`${roomId}
|
|
51
|
+
this.logger.info(`${roomId}直播间连接已关闭`);
|
|
51
52
|
// 直接返回
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
55
|
// 未关闭成功
|
|
55
|
-
this.logger.warn(`${roomId}
|
|
56
|
+
this.logger.warn(`${roomId}直播间连接未成功关闭`);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
exports.default = BLive;
|
package/lib/comRegister.js
CHANGED
|
@@ -997,10 +997,6 @@ class ComRegister {
|
|
|
997
997
|
let pushAtTimeTimer;
|
|
998
998
|
// 定义弹幕存放数组
|
|
999
999
|
const currentLiveDanmakuArr = [];
|
|
1000
|
-
// init flag
|
|
1001
|
-
let initFlag = false;
|
|
1002
|
-
// 连接中断flag
|
|
1003
|
-
let connFlag = false;
|
|
1004
1000
|
// 定义开播状态
|
|
1005
1001
|
let liveStatus = false;
|
|
1006
1002
|
// 定义channelIdArr总长度
|
|
@@ -1093,31 +1089,6 @@ class ComRegister {
|
|
|
1093
1089
|
};
|
|
1094
1090
|
// 构建消息处理函数
|
|
1095
1091
|
const handler = {
|
|
1096
|
-
onOpen: () => {
|
|
1097
|
-
if (!initFlag) {
|
|
1098
|
-
// init flag设置为true
|
|
1099
|
-
initFlag = true;
|
|
1100
|
-
// connFlag设置为false
|
|
1101
|
-
connFlag = false;
|
|
1102
|
-
// logger
|
|
1103
|
-
this.logger.info(`[${roomId}]直播间连接已建立!`);
|
|
1104
|
-
}
|
|
1105
|
-
},
|
|
1106
|
-
onClose: async () => {
|
|
1107
|
-
if (!connFlag) {
|
|
1108
|
-
// 更直播状态
|
|
1109
|
-
liveStatus = false;
|
|
1110
|
-
// 关闭定时推送
|
|
1111
|
-
pushAtTimeTimer?.();
|
|
1112
|
-
// 停止服务
|
|
1113
|
-
this.ctx.bl.closeListener(roomId);
|
|
1114
|
-
// 更改connFlag
|
|
1115
|
-
connFlag = true;
|
|
1116
|
-
// 发送消息
|
|
1117
|
-
await this.sendPrivateMsg(`[${roomId}]直播间连接已中断!`);
|
|
1118
|
-
this.logger.error(`[${roomId}]直播间连接已中断!`);
|
|
1119
|
-
}
|
|
1120
|
-
},
|
|
1121
1092
|
onError: async () => {
|
|
1122
1093
|
// 更直播状态
|
|
1123
1094
|
liveStatus = false;
|
package/package.json
CHANGED
package/readme.md
CHANGED