koishi-plugin-bilibili-notify 3.2.1-alpha.2 → 3.2.1-alpha.4

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 CHANGED
@@ -32,6 +32,8 @@ class BLive extends koishi_1.Service {
32
32
  uid: mySelfInfo.data.mid,
33
33
  },
34
34
  });
35
+ // logger
36
+ this.logger.info(`[${roomId}]开始监听直播间消息!`);
35
37
  }
36
38
  closeListener(roomId) {
37
39
  // 判断直播间监听器是否关闭
@@ -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,30 +1089,16 @@ 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
- }
1092
+ onError: async () => {
1093
+ // 更直播状态
1094
+ liveStatus = false;
1095
+ // 关闭定时推送
1096
+ pushAtTimeTimer?.();
1097
+ // 停止服务
1098
+ this.ctx.bl.closeListener(roomId);
1099
+ // 发送消息
1100
+ await this.sendPrivateMsg(`[${roomId}]直播间连接发生错误!`);
1101
+ this.logger.error(`[${roomId}]直播间连接发生错误!`);
1120
1102
  },
1121
1103
  onIncomeDanmu: ({ body }) => {
1122
1104
  // 保存消息到数组
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.2.1-alpha.2",
4
+ "version": "3.2.1-alpha.4",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -259,6 +259,8 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
259
259
  - ver 3.2.1-alpha.0 新增:多个相同平台bot可以选择某个群聊/频道指定机器人发送; 优化:直播检测 `WS` 模式下播后仍推送、添加依赖 `cacheable-lookup` 优化网络; 修复:打开 `pushImagesInDynamic` 功能时,如果发送的动态里没有图片则会报错 `TypeError: Cannot read properties of null (reading 'opus')`
260
260
  - ver 3.2.1-alpha.1 调整:将项目构建产物调整为 `esm`;
261
261
  - ver 3.2.1-alpha.2 调整:将项目构建产物调整回 `cjs` 、将依赖 `cacheable-lookup` 导入方式更改为动态导入;
262
+ - ver 3.2.1-alpha.3 修复:直播检测 `WS` 初始化后自动断开连接;
263
+ - ver 3.2.1-alpha.4 优化:直播监听初始化没有提示;
262
264
 
263
265
  ## 交流群
264
266