koishi-plugin-bilibili-notify 3.2.1-alpha.8 → 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/database.js CHANGED
@@ -1,5 +1,9 @@
1
- export const name = "Database";
2
- export function apply(ctx) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.name = void 0;
4
+ exports.apply = apply;
5
+ exports.name = "Database";
6
+ function apply(ctx) {
3
7
  // 新增LoginBili表
4
8
  ctx.model.extend("loginBili", {
5
9
  id: "unsigned",
@@ -1,8 +1,10 @@
1
- import { Schema, Service } from "koishi";
2
- import { DateTime } from "luxon";
3
- import { resolve } from "node:path";
4
- import { pathToFileURL } from "node:url";
5
- import { withRetry } from "./utils";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const koishi_1 = require("koishi");
4
+ const luxon_1 = require("luxon");
5
+ const node_path_1 = require("node:path");
6
+ const node_url_1 = require("node:url");
7
+ const utils_1 = require("./utils");
6
8
  // 动态类型
7
9
  const DYNAMIC_TYPE_NONE = "DYNAMIC_TYPE_NONE";
8
10
  const DYNAMIC_TYPE_FORWARD = "DYNAMIC_TYPE_FORWARD";
@@ -20,7 +22,7 @@ const DYNAMIC_TYPE_LIVE_RCMD = "DYNAMIC_TYPE_LIVE_RCMD";
20
22
  const DYNAMIC_TYPE_UGC_SEASON = "DYNAMIC_TYPE_UGC_SEASON";
21
23
  // 内容卡片类型
22
24
  const ADDITIONAL_TYPE_RESERVE = "ADDITIONAL_TYPE_RESERVE";
23
- class GenerateImg extends Service {
25
+ class GenerateImg extends koishi_1.Service {
24
26
  static inject = ["puppeteer", "ba"];
25
27
  giConfig;
26
28
  constructor(ctx, config) {
@@ -52,7 +54,7 @@ class GenerateImg extends Service {
52
54
  data, username, userface, followerDisplay, liveStatus /*0未开播 1刚开播 2已开播 3停止直播*/, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder, } = {}) {
53
55
  const [titleStatus, liveTime, cover] = await this.getLiveStatus(data.live_time, liveStatus);
54
56
  // 加载字体
55
- const fontURL = pathToFileURL(resolve(__dirname, "font/HYZhengYuan-75W.ttf"));
57
+ const fontURL = (0, node_url_1.pathToFileURL)((0, node_path_1.resolve)(__dirname, "font/HYZhengYuan-75W.ttf"));
56
58
  // 卡片内容
57
59
  const html = /* html */ `
58
60
  <!DOCTYPE html>
@@ -207,7 +209,7 @@ class GenerateImg extends Service {
207
209
  </html>
208
210
  `;
209
211
  // 多次尝试生成图片
210
- return await withRetry(() => this.imgHandler(html)).catch((e) => {
212
+ return await (0, utils_1.withRetry)(() => this.imgHandler(html)).catch((e) => {
211
213
  // 已尝试三次
212
214
  throw new Error(`生成图片失败!错误: ${e.toString()}`);
213
215
  });
@@ -288,7 +290,7 @@ class GenerateImg extends Service {
288
290
  }
289
291
  // 图片
290
292
  let major = "";
291
- const arrowImg = pathToFileURL(resolve(__dirname, "img/arrow.png"));
293
+ const arrowImg = (0, node_url_1.pathToFileURL)((0, node_path_1.resolve)(__dirname, "img/arrow.png"));
292
294
  if (module_dynamic?.major?.opus?.pics) {
293
295
  if (module_dynamic.major.opus.pics.length === 1) {
294
296
  const height = module_dynamic.major.opus.pics[0].height;
@@ -564,7 +566,7 @@ class GenerateImg extends Service {
564
566
  // 获取动态主要内容
565
567
  const [main] = await getDynamicMajor(data, false);
566
568
  // 加载字体
567
- const fontURL = pathToFileURL(resolve(__dirname, "font/HYZhengYuan-75W.ttf"));
569
+ const fontURL = (0, node_url_1.pathToFileURL)((0, node_path_1.resolve)(__dirname, "font/HYZhengYuan-75W.ttf"));
568
570
  // 判断是否开启大字体模式
569
571
  let style;
570
572
  if (this.giConfig.enableLargeFont) {
@@ -1395,7 +1397,7 @@ class GenerateImg extends Service {
1395
1397
  </html>
1396
1398
  `;
1397
1399
  // 多次尝试生成图片
1398
- return await withRetry(() => this.imgHandler(html)).catch((e) => {
1400
+ return await (0, utils_1.withRetry)(() => this.imgHandler(html)).catch((e) => {
1399
1401
  // 已尝试三次
1400
1402
  throw new Error(`生成图片失败!错误: ${e.toString()}`);
1401
1403
  });
@@ -1434,11 +1436,11 @@ class GenerateImg extends Service {
1434
1436
  }
1435
1437
  async getTimeDifference(dateString) {
1436
1438
  // 将日期字符串转换为Date对象
1437
- const apiDateTime = DateTime.fromFormat(dateString, "yyyy-MM-dd HH:mm:ss", {
1439
+ const apiDateTime = luxon_1.DateTime.fromFormat(dateString, "yyyy-MM-dd HH:mm:ss", {
1438
1440
  zone: "UTC+8",
1439
1441
  });
1440
1442
  // 获取当前时间
1441
- const currentDateTime = DateTime.now();
1443
+ const currentDateTime = luxon_1.DateTime.now();
1442
1444
  // 计算时间差
1443
1445
  const diff = currentDateTime.diff(apiDateTime, [
1444
1446
  "years",
@@ -1480,24 +1482,24 @@ class GenerateImg extends Service {
1480
1482
  }
1481
1483
  }
1482
1484
  (function (GenerateImg) {
1483
- GenerateImg.Config = Schema.object({
1484
- filter: Schema.object({
1485
- enable: Schema.boolean(),
1486
- notify: Schema.boolean(),
1487
- regex: Schema.string(),
1488
- keywords: Schema.array(String),
1489
- forward: Schema.boolean(),
1490
- article: Schema.boolean(),
1485
+ GenerateImg.Config = koishi_1.Schema.object({
1486
+ filter: koishi_1.Schema.object({
1487
+ enable: koishi_1.Schema.boolean(),
1488
+ notify: koishi_1.Schema.boolean(),
1489
+ regex: koishi_1.Schema.string(),
1490
+ keywords: koishi_1.Schema.array(String),
1491
+ forward: koishi_1.Schema.boolean(),
1492
+ article: koishi_1.Schema.boolean(),
1491
1493
  }),
1492
- removeBorder: Schema.boolean(),
1493
- cardColorStart: Schema.string(),
1494
- cardColorEnd: Schema.string(),
1495
- cardBasePlateColor: Schema.string(),
1496
- cardBasePlateBorder: Schema.string(),
1497
- enableLargeFont: Schema.boolean(),
1498
- font: Schema.string(),
1499
- hideDesc: Schema.boolean(),
1500
- followerDisplay: Schema.boolean(),
1494
+ removeBorder: koishi_1.Schema.boolean(),
1495
+ cardColorStart: koishi_1.Schema.string(),
1496
+ cardColorEnd: koishi_1.Schema.string(),
1497
+ cardBasePlateColor: koishi_1.Schema.string(),
1498
+ cardBasePlateBorder: koishi_1.Schema.string(),
1499
+ enableLargeFont: koishi_1.Schema.boolean(),
1500
+ font: koishi_1.Schema.string(),
1501
+ hideDesc: koishi_1.Schema.boolean(),
1502
+ followerDisplay: koishi_1.Schema.boolean(),
1501
1503
  });
1502
1504
  })(GenerateImg || (GenerateImg = {}));
1503
- export default GenerateImg;
1505
+ exports.default = GenerateImg;
package/lib/index.js CHANGED
@@ -1,15 +1,55 @@
1
- import { Schema, Service } from "koishi";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Config = exports.name = exports.inject = void 0;
40
+ exports.apply = apply;
41
+ const koishi_1 = require("koishi");
2
42
  // import plugins
3
- import ComRegister from "./comRegister";
4
- import * as Database from "./database";
43
+ const comRegister_1 = __importDefault(require("./comRegister"));
44
+ const Database = __importStar(require("./database"));
5
45
  // import Service
6
- import GenerateImg from "./generateImg";
7
- import BiliAPI from "./biliAPI";
8
- import BLive from "./blive";
9
- export const inject = ["puppeteer", "database", "notifier"];
10
- export const name = "bilibili-notify";
46
+ const generateImg_1 = __importDefault(require("./generateImg"));
47
+ const biliAPI_1 = __importDefault(require("./biliAPI"));
48
+ const blive_1 = __importDefault(require("./blive"));
49
+ exports.inject = ["puppeteer", "database", "notifier"];
50
+ exports.name = "bilibili-notify";
11
51
  let globalConfig;
12
- class ServerManager extends Service {
52
+ class ServerManager extends koishi_1.Service {
13
53
  // 服务
14
54
  servers = [];
15
55
  constructor(ctx) {
@@ -65,12 +105,12 @@ class ServerManager extends Service {
65
105
  // 注册插件
66
106
  try {
67
107
  // BA = BiliAPI
68
- const ba = this.ctx.plugin(BiliAPI, {
108
+ const ba = this.ctx.plugin(biliAPI_1.default, {
69
109
  userAgent: globalConfig.userAgent,
70
110
  key: globalConfig.key,
71
111
  });
72
112
  // GI = GenerateImg
73
- const gi = this.ctx.plugin(GenerateImg, {
113
+ const gi = this.ctx.plugin(generateImg_1.default, {
74
114
  filter: globalConfig.filter,
75
115
  removeBorder: globalConfig.removeBorder,
76
116
  cardColorStart: globalConfig.cardColorStart,
@@ -83,7 +123,7 @@ class ServerManager extends Service {
83
123
  followerDisplay: globalConfig.followerDisplay,
84
124
  });
85
125
  // CR = ComRegister
86
- const cr = this.ctx.plugin(ComRegister, {
126
+ const cr = this.ctx.plugin(comRegister_1.default, {
87
127
  sub: globalConfig.sub,
88
128
  master: globalConfig.master,
89
129
  liveDetectType: globalConfig.liveDetectType,
@@ -98,7 +138,7 @@ class ServerManager extends Service {
98
138
  dynamicDebugMode: globalConfig.dynamicDebugMode,
99
139
  });
100
140
  // BL = BLive
101
- const bl = this.ctx.plugin(BLive);
141
+ const bl = this.ctx.plugin(blive_1.default);
102
142
  // 添加服务
103
143
  this.servers.push(ba);
104
144
  this.servers.push(bl);
@@ -149,7 +189,7 @@ class ServerManager extends Service {
149
189
  });
150
190
  };
151
191
  }
152
- export function apply(ctx, config) {
192
+ function apply(ctx, config) {
153
193
  // 设置config
154
194
  globalConfig = config;
155
195
  // 设置提示
@@ -169,23 +209,23 @@ export function apply(ctx, config) {
169
209
  return next();
170
210
  });
171
211
  }
172
- export const Config = Schema.object({
173
- require: Schema.object({}).description("必填设置"),
174
- key: Schema.string()
212
+ exports.Config = koishi_1.Schema.object({
213
+ require: koishi_1.Schema.object({}).description("必填设置"),
214
+ key: koishi_1.Schema.string()
175
215
  .pattern(/^[0-9a-f]{32}$/)
176
216
  .role("secret")
177
217
  .required()
178
218
  .description("请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/"),
179
- master: Schema.intersect([
180
- Schema.object({
181
- enable: Schema.boolean()
219
+ master: koishi_1.Schema.intersect([
220
+ koishi_1.Schema.object({
221
+ enable: koishi_1.Schema.boolean()
182
222
  .default(false)
183
223
  .description("是否开启主人账号功能,如果您的机器人没有私聊权限请不要开启此功能。开启后如果机器人运行错误会向您进行报告"),
184
224
  }).description("主人账号"),
185
- Schema.union([
186
- Schema.object({
187
- enable: Schema.const(true).required(),
188
- platform: Schema.union([
225
+ koishi_1.Schema.union([
226
+ koishi_1.Schema.object({
227
+ enable: koishi_1.Schema.const(true).required(),
228
+ platform: koishi_1.Schema.union([
189
229
  "qq",
190
230
  "qqguild",
191
231
  "onebot",
@@ -196,165 +236,165 @@ export const Config = Schema.object({
196
236
  "chronocat",
197
237
  "lark",
198
238
  ]).description("请选择您的私人机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件"),
199
- masterAccount: Schema.string()
239
+ masterAccount: koishi_1.Schema.string()
200
240
  .role("secret")
201
241
  .required()
202
242
  .description("主人账号,在Q群使用可直接使用QQ号,若在其他平台使用,请使用inspect插件获取自身ID"),
203
- masterAccountGuildId: Schema.string()
243
+ masterAccountGuildId: koishi_1.Schema.string()
204
244
  .role("secret")
205
245
  .description("主人账号所在的群组ID,只有在QQ频道、Discord这样的环境才需要填写,请使用inspect插件获取群组ID"),
206
246
  }),
207
- Schema.object({}),
247
+ koishi_1.Schema.object({}),
208
248
  ]),
209
249
  ]),
210
- basicSettings: Schema.object({}).description("基本设置"),
211
- userAgent: Schema.string()
250
+ basicSettings: koishi_1.Schema.object({}).description("基本设置"),
251
+ userAgent: koishi_1.Schema.string()
212
252
  .required()
213
253
  .description("设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111"),
214
- subTitle: Schema.object({}).description("订阅配置"),
215
- sub: Schema.array(Schema.object({
216
- name: Schema.string().description("订阅用户昵称,只是给你自己看的(相当于备注),可填可不填"),
217
- uid: Schema.string().required().description("订阅用户UID"),
218
- dynamic: Schema.boolean().default(false).description("是否订阅用户动态"),
219
- live: Schema.boolean().default(false).description("是否订阅用户直播"),
220
- target: Schema.array(Schema.object({
221
- platform: Schema.string()
254
+ subTitle: koishi_1.Schema.object({}).description("订阅配置"),
255
+ sub: koishi_1.Schema.array(koishi_1.Schema.object({
256
+ name: koishi_1.Schema.string().description("订阅用户昵称,只是给你自己看的(相当于备注),可填可不填"),
257
+ uid: koishi_1.Schema.string().required().description("订阅用户UID"),
258
+ dynamic: koishi_1.Schema.boolean().default(false).description("是否订阅用户动态"),
259
+ live: koishi_1.Schema.boolean().default(false).description("是否订阅用户直播"),
260
+ target: koishi_1.Schema.array(koishi_1.Schema.object({
261
+ platform: koishi_1.Schema.string()
222
262
  .required()
223
263
  .description("推送平台,例如onebot、qq、discord"),
224
- channelArr: Schema.array(Schema.object({
225
- channelId: Schema.string().required().description("频道/群组号"),
226
- dynamic: Schema.boolean()
264
+ channelArr: koishi_1.Schema.array(koishi_1.Schema.object({
265
+ channelId: koishi_1.Schema.string().required().description("频道/群组号"),
266
+ dynamic: koishi_1.Schema.boolean()
227
267
  .default(false)
228
268
  .description("该频道/群组是否推送动态信息"),
229
- live: Schema.boolean()
269
+ live: koishi_1.Schema.boolean()
230
270
  .default(false)
231
271
  .description("该频道/群组是否推送直播通知"),
232
- liveGuardBuy: Schema.boolean()
272
+ liveGuardBuy: koishi_1.Schema.boolean()
233
273
  .default(false)
234
274
  .description("该频道/群组是否推送上舰消息"),
235
- atAll: Schema.boolean()
275
+ atAll: koishi_1.Schema.boolean()
236
276
  .default(false)
237
277
  .description("推送开播通知时是否艾特全体成员"),
238
- bot: Schema.string()
278
+ bot: koishi_1.Schema.string()
239
279
  .description("若您有多个相同平台机器人,可在此填写当前群聊执行推送的机器人账号。不填则默认第一个")
240
280
  }))
241
281
  .role("table")
242
282
  .required()
243
283
  .description("需推送的频道/群组详细设置"),
244
284
  })).description("订阅用户需要发送的平台和频道/群组信息(一个平台下可以推送多个频道/群组)"),
245
- card: Schema.intersect([
246
- Schema.object({
247
- enable: Schema.boolean()
285
+ card: koishi_1.Schema.intersect([
286
+ koishi_1.Schema.object({
287
+ enable: koishi_1.Schema.boolean()
248
288
  .default(false)
249
289
  .description("是否开启自定义卡片颜色"),
250
290
  }),
251
- Schema.union([
252
- Schema.object({
253
- enable: Schema.const(true).required(),
254
- cardColorStart: Schema.string()
291
+ koishi_1.Schema.union([
292
+ koishi_1.Schema.object({
293
+ enable: koishi_1.Schema.const(true).required(),
294
+ cardColorStart: koishi_1.Schema.string()
255
295
  .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
256
296
  .description("推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/"),
257
- cardColorEnd: Schema.string()
297
+ cardColorEnd: koishi_1.Schema.string()
258
298
  .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
259
299
  .description("推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/"),
260
- cardBasePlateColor: Schema.string()
300
+ cardBasePlateColor: koishi_1.Schema.string()
261
301
  .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
262
302
  .description("推送卡片底板颜色,请填入16进制颜色代码"),
263
- cardBasePlateBorder: Schema.string()
303
+ cardBasePlateBorder: koishi_1.Schema.string()
264
304
  .pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/)
265
305
  .description("推送卡片底板边框宽度,请填入css单位,例如1px,12.5rem,100%"),
266
306
  }),
267
- Schema.object({}),
307
+ koishi_1.Schema.object({}),
268
308
  ]),
269
309
  ]),
270
310
  }).collapse())
271
311
  .collapse()
272
312
  .description("输入订阅信息,自定义订阅内容; uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播"),
273
- dynamic: Schema.object({}).description("动态推送设置"),
274
- dynamicUrl: Schema.boolean()
313
+ dynamic: koishi_1.Schema.object({}).description("动态推送设置"),
314
+ dynamicUrl: koishi_1.Schema.boolean()
275
315
  .default(false)
276
316
  .description("发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!"),
277
- pushImgsInDynamic: Schema.boolean()
317
+ pushImgsInDynamic: koishi_1.Schema.boolean()
278
318
  .default(false)
279
319
  .description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
280
- live: Schema.object({}).description("直播推送设置"),
281
- liveDetectType: Schema.union([
282
- Schema.const("WS").description("使用WebSocket连接到B站消息服务器进行直播检测,推荐使用"),
283
- Schema.const("API").description("通过轮询API发送请求监测直播状态,此模式理论可无限订阅,但容易产生其他问题,功能没有WS模式全面").experimental(),
320
+ live: koishi_1.Schema.object({}).description("直播推送设置"),
321
+ liveDetectType: koishi_1.Schema.union([
322
+ koishi_1.Schema.const("WS").description("使用WebSocket连接到B站消息服务器进行直播检测,推荐使用"),
323
+ koishi_1.Schema.const("API").description("通过轮询API发送请求监测直播状态,此模式理论可无限订阅,但容易产生其他问题,功能没有WS模式全面").experimental(),
284
324
  ])
285
325
  .role("radio")
286
326
  .default("WS")
287
327
  .description("直播检测方式,WS为连接到B站消息服务器,API为通过轮询发送请求监测,默认使用WS检测"),
288
- restartPush: Schema.boolean()
328
+ restartPush: koishi_1.Schema.boolean()
289
329
  .default(true)
290
330
  .description("插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启"),
291
- pushTime: Schema.number()
331
+ pushTime: koishi_1.Schema.number()
292
332
  .min(0)
293
333
  .max(12)
294
334
  .step(0.5)
295
335
  .default(1)
296
336
  .description("设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时"),
297
- customLiveStart: Schema.string()
337
+ customLiveStart: koishi_1.Schema.string()
298
338
  .default("-name开播啦,当前粉丝数:-follower\\n-link")
299
339
  .description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name开播啦,会发送为xxxUP开播啦"),
300
- customLive: Schema.string()
340
+ customLive: koishi_1.Schema.string()
301
341
  .default("-name正在直播,目前已播-time,累计观看人数:-watched\\n-link")
302
342
  .description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-watched代表累计观看人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name正在直播,会发送为xxxUP正在直播xxx"),
303
- customLiveEnd: Schema.string()
343
+ customLiveEnd: koishi_1.Schema.string()
304
344
  .default("-name下播啦,本次直播了-time,粉丝数变化-follower_change")
305
345
  .description("自定义下播提示语,-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长,\\n为换行。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
306
- followerDisplay: Schema.boolean()
346
+ followerDisplay: koishi_1.Schema.boolean()
307
347
  .default(true)
308
348
  .description("粉丝数变化和累积观看本场直播的人数是否显示在推送卡片中"),
309
- hideDesc: Schema.boolean()
349
+ hideDesc: koishi_1.Schema.boolean()
310
350
  .default(false)
311
351
  .description("是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介"),
312
- style: Schema.object({}).description("美化设置"),
313
- removeBorder: Schema.boolean().default(false).description("移除推送卡片边框"),
314
- cardColorStart: Schema.string()
352
+ style: koishi_1.Schema.object({}).description("美化设置"),
353
+ removeBorder: koishi_1.Schema.boolean().default(false).description("移除推送卡片边框"),
354
+ cardColorStart: koishi_1.Schema.string()
315
355
  .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
316
356
  .default("#F38AB5")
317
357
  .description("推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/"),
318
- cardColorEnd: Schema.string()
358
+ cardColorEnd: koishi_1.Schema.string()
319
359
  .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
320
360
  .default("#F9CCDF")
321
361
  .description("推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/"),
322
- cardBasePlateColor: Schema.string()
362
+ cardBasePlateColor: koishi_1.Schema.string()
323
363
  .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
324
364
  .default("#FFF5EE")
325
365
  .description("推送卡片底板颜色,请填入16进制颜色代码"),
326
- cardBasePlateBorder: Schema.string()
366
+ cardBasePlateBorder: koishi_1.Schema.string()
327
367
  .pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/)
328
368
  .default("15px")
329
369
  .description("推送卡片底板边框宽度,请填入css单位,例如1px,12.5rem,100%"),
330
- enableLargeFont: Schema.boolean()
370
+ enableLargeFont: koishi_1.Schema.boolean()
331
371
  .default(false)
332
372
  .description("是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看"),
333
- font: Schema.string().description("推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei"),
334
- filter: Schema.intersect([
335
- Schema.object({
336
- enable: Schema.boolean()
373
+ font: koishi_1.Schema.string().description("推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei"),
374
+ filter: koishi_1.Schema.intersect([
375
+ koishi_1.Schema.object({
376
+ enable: koishi_1.Schema.boolean()
337
377
  .default(false)
338
378
  .description("是否开启动态屏蔽功能"),
339
379
  }).description("屏蔽设置"),
340
- Schema.union([
341
- Schema.object({
342
- enable: Schema.const(true).required().experimental(),
343
- notify: Schema.boolean()
380
+ koishi_1.Schema.union([
381
+ koishi_1.Schema.object({
382
+ enable: koishi_1.Schema.const(true).required().experimental(),
383
+ notify: koishi_1.Schema.boolean()
344
384
  .default(false)
345
385
  .description("动态被屏蔽是否发送提示"),
346
- regex: Schema.string().description("正则表达式屏蔽"),
347
- keywords: Schema.array(String).description("关键字屏蔽,一个关键字为一项"),
348
- forward: Schema.boolean()
386
+ regex: koishi_1.Schema.string().description("正则表达式屏蔽"),
387
+ keywords: koishi_1.Schema.array(String).description("关键字屏蔽,一个关键字为一项"),
388
+ forward: koishi_1.Schema.boolean()
349
389
  .default(false)
350
390
  .description("是否屏蔽转发动态"),
351
- article: Schema.boolean().default(false).description("是否屏蔽专栏"),
391
+ article: koishi_1.Schema.boolean().default(false).description("是否屏蔽专栏"),
352
392
  }),
353
- Schema.object({}),
393
+ koishi_1.Schema.object({}),
354
394
  ]),
355
395
  ]),
356
- debug: Schema.object({}).description("调试设置"),
357
- dynamicDebugMode: Schema.boolean()
396
+ debug: koishi_1.Schema.object({}).description("调试设置"),
397
+ dynamicDebugMode: koishi_1.Schema.boolean()
358
398
  .default(false)
359
399
  .description("动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试"),
360
400
  });
package/lib/type/index.js CHANGED
@@ -1,15 +1,18 @@
1
- export var LiveType;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PushType = exports.LiveType = void 0;
4
+ var LiveType;
2
5
  (function (LiveType) {
3
6
  LiveType[LiveType["NotLiveBroadcast"] = 0] = "NotLiveBroadcast";
4
7
  LiveType[LiveType["StartBroadcasting"] = 1] = "StartBroadcasting";
5
8
  LiveType[LiveType["LiveBroadcast"] = 2] = "LiveBroadcast";
6
9
  LiveType[LiveType["StopBroadcast"] = 3] = "StopBroadcast";
7
10
  LiveType[LiveType["FirstLiveBroadcast"] = 4] = "FirstLiveBroadcast";
8
- })(LiveType || (LiveType = {}));
9
- export var PushType;
11
+ })(LiveType || (exports.LiveType = LiveType = {}));
12
+ var PushType;
10
13
  (function (PushType) {
11
14
  PushType[PushType["Live"] = 0] = "Live";
12
15
  PushType[PushType["Dynamic"] = 1] = "Dynamic";
13
16
  PushType[PushType["StartBroadcasting"] = 2] = "StartBroadcasting";
14
17
  PushType[PushType["LiveGuardBuy"] = 3] = "LiveGuardBuy";
15
- })(PushType || (PushType = {}));
18
+ })(PushType || (exports.PushType = PushType = {}));
@@ -1,4 +1,9 @@
1
- export function Retry(options = { attempts: 3 }) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Retry = Retry;
4
+ exports.withLock = withLock;
5
+ exports.withRetry = withRetry;
6
+ function Retry(options = { attempts: 3 }) {
2
7
  return (
3
8
  // biome-ignore lint/complexity/noBannedTypes: <explanation>
4
9
  target, propertyKey,
@@ -30,7 +35,7 @@ export function Retry(options = { attempts: 3 }) {
30
35
  * @param {Function} fn - 需要包装的原始函数
31
36
  * @returns {Function} 带锁功能的函数
32
37
  */
33
- export function withLock(fn) {
38
+ function withLock(fn) {
34
39
  // 判断是否是异步函数
35
40
  const isAsync = fn.constructor.name === "AsyncFunction";
36
41
  // 定义锁标志
@@ -81,7 +86,7 @@ export function withLock(fn) {
81
86
  }
82
87
  };
83
88
  }
84
- export async function withRetry(fn, maxAttempts = 3, delayMs = 1000) {
89
+ async function withRetry(fn, maxAttempts = 3, delayMs = 1000) {
85
90
  let attempt = 0;
86
91
  while (attempt < maxAttempts) {
87
92
  try {
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.8",
4
+ "version": "3.2.1-alpha.9",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
@@ -28,22 +28,23 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@akokko/blive-message-listener": "^0.5.1",
31
- "axios": "^1.9.0",
32
- "axios-cookiejar-support": "^6.0.2",
31
+ "axios": "^1.7.9",
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
- "tough-cookie": "^5.1.2"
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,10 +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` 回退版本;
267
- - ver 3.2.1-alpha.8 调整:将项目构建产物调整为 `esm`; 优化:所有依赖更新;
264
+ - ver 3.2.1-alpha.4 - ver 3.2.1-alpha.8 `deprecate`
265
+ - ver 3.2.1-alpha.9 修复:`bugs`
268
266
 
269
267
  ## 交流群
270
268