koishi-plugin-bilibili-notify 3.2.1-alpha.7 → 3.2.1-alpha.9

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/biliAPI.d.ts CHANGED
@@ -11,6 +11,7 @@ declare class BiliAPI extends Service {
11
11
  static inject: string[];
12
12
  jar: CookieJar;
13
13
  client: AxiosInstance;
14
+ cacheable: any;
14
15
  apiConfig: BiliAPI.Config;
15
16
  loginData: any;
16
17
  loginNotifier: Notifier;
package/lib/biliAPI.js CHANGED
@@ -53,6 +53,8 @@ class BiliAPI extends koishi_1.Service {
53
53
  static inject = ["database", "notifier"];
54
54
  jar;
55
55
  client;
56
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
57
+ cacheable;
56
58
  apiConfig;
57
59
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
58
60
  loginData;
package/lib/blive.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type Awaitable, type Context, Service } from "koishi";
2
- import { type MsgHandler } from "@akokko/blive-message-listener";
2
+ import { type MsgHandler } from "blive-message-listener";
3
3
  declare module "koishi" {
4
4
  interface Context {
5
5
  bl: BLive;
package/lib/blive.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const koishi_1 = require("koishi");
4
- const blive_message_listener_1 = require("@akokko/blive-message-listener");
4
+ const blive_message_listener_1 = require("blive-message-listener");
5
5
  class BLive extends koishi_1.Service {
6
6
  // 必要服务
7
7
  static inject = ["ba"];
@@ -19,29 +19,26 @@ class BLive extends koishi_1.Service {
19
19
  }
20
20
  }
21
21
  async startLiveRoomListener(roomId, handler) {
22
- try {
23
- // 获取cookieStr
24
- const cookiesStr = await this.ctx.ba.getCookiesForHeader();
25
- // 获取自身信息
26
- const mySelfInfo = await this.ctx.ba.getMyselfInfo();
27
- // 创建实例并保存到Record中
28
- this.listenerRecord[roomId] = (0, blive_message_listener_1.startListen)(Number.parseInt(roomId), handler, {
29
- ws: {
30
- headers: {
31
- Cookie: cookiesStr,
32
- },
33
- uid: mySelfInfo.data.mid,
22
+ // 获取cookieStr
23
+ const cookiesStr = await this.ctx.ba.getCookiesForHeader();
24
+ // 获取自身信息
25
+ const mySelfInfo = await this.ctx.ba.getMyselfInfo();
26
+ // 创建实例并保存到Record中
27
+ this.listenerRecord[roomId] = (0, blive_message_listener_1.startListen)(Number.parseInt(roomId), handler, {
28
+ ws: {
29
+ headers: {
30
+ Cookie: cookiesStr,
34
31
  },
35
- });
36
- }
37
- catch (e) {
38
- // logger
39
- this.logger.info(`[${roomId}]监听直播间消息失败!错误:${e.message}`);
40
- }
32
+ uid: mySelfInfo.data.mid,
33
+ },
34
+ });
35
+ // logger
36
+ this.logger.info(`[${roomId}]开始监听直播间消息!`);
41
37
  }
42
38
  closeListener(roomId) {
43
39
  // 判断直播间监听器是否关闭
44
- if (!this.listenerRecord || !this.listenerRecord[roomId]?.closed) {
40
+ if (!this.listenerRecord ||
41
+ !this.listenerRecord[roomId]?.closed) {
45
42
  // 输出logger
46
43
  this.logger.info(`${roomId}直播间弹幕监听器无需关闭`);
47
44
  }
@@ -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
@@ -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.7",
4
+ "version": "3.2.1-alpha.9",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
@@ -30,20 +30,21 @@
30
30
  "@akokko/blive-message-listener": "^0.5.1",
31
31
  "axios": "^1.7.9",
32
32
  "axios-cookiejar-support": "^5.0.5",
33
+ "blive-message-listener": "^0.5.0",
33
34
  "cron": "^4.3.0",
34
- "jsdom": "^26.1.0",
35
- "luxon": "^3.6.1",
35
+ "jsdom": "^24.1.3",
36
+ "luxon": "^3.5.0",
36
37
  "md5": "^2.3.0",
37
38
  "qrcode": "^1.5.4",
38
39
  "tough-cookie": "^4.1.4"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@biomejs/biome": "1.9.4",
42
- "@types/luxon": "^3.6.2",
43
+ "@types/luxon": "^3.4.2",
43
44
  "@types/md5": "^2.3.5",
44
45
  "@types/qrcode": "^1.5.5",
45
46
  "@types/tough-cookie": "^4.0.5",
46
- "globals": "^16.2.0",
47
+ "globals": "^15.14.0",
47
48
  "koishi-plugin-puppeteer": "^3.9.0"
48
49
  },
49
50
  "koishi": {
package/readme.md CHANGED
@@ -261,9 +261,8 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
261
261
  - ver 3.2.1-alpha.2 调整:将项目构建产物调整回 `cjs` 、将依赖 `cacheable-lookup` 导入方式更改为动态导入;
262
262
  - ver 3.2.1-alpha.3 修复:直播检测 `WS` 初始化后自动断开连接;
263
263
  - ver 3.2.1-alpha.4 优化:直播监听初始化没有提示;
264
- - ver 3.2.1-alpha.5 修复:临时更换依赖 `blive-message-listener` `@akokko/blive-message-listener` 以解决直播检测 `WS` 模式连接中断的问题;
265
- - ver 3.2.1-alpha.6 修复:依赖 `axios-cookiejar-support@6.0.2` 为纯ESM依赖,运行报错 Error [ERR_REQUIRE_ESM]: require() of ES Module `xxx` not supported,降级回 `axios-cookiejar-support@5.0.5`
266
- - ver 3.2.1-alpha.7 修复:依赖 `tough-cookie` 和 `axios` 回退版本;
264
+ - ver 3.2.1-alpha.4 - ver 3.2.1-alpha.8 `deprecate`
265
+ - ver 3.2.1-alpha.9 修复:`bugs`
267
266
 
268
267
  ## 交流群
269
268