koishi-plugin-bilibili-notify 1.0.12 → 1.0.14

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
@@ -12,6 +12,7 @@ declare class BiliAPI extends Service {
12
12
  client: any;
13
13
  loginData: any;
14
14
  loginNotifier: Notifier;
15
+ refreshCookieTimer: Function;
15
16
  constructor(ctx: Context);
16
17
  protected start(): void | Promise<void>;
17
18
  getServerUTCTime(): Promise<number>;
package/lib/biliAPI.js CHANGED
@@ -25,6 +25,7 @@ class BiliAPI extends koishi_1.Service {
25
25
  client;
26
26
  loginData;
27
27
  loginNotifier;
28
+ refreshCookieTimer;
28
29
  constructor(ctx) {
29
30
  super(ctx, 'biliAPI');
30
31
  }
@@ -35,6 +36,52 @@ class BiliAPI extends koishi_1.Service {
35
36
  this.loadCookiesFromDatabase();
36
37
  // this.logger.info('BiliAPI已被注册到Context中')
37
38
  }
39
+ /* async test_refresh_token() {
40
+ const publicKey = await crypto.subtle.importKey(
41
+ "jwk",
42
+ {
43
+ kty: "RSA",
44
+ n: "y4HdjgJHBlbaBN04VERG4qNBIFHP6a3GozCl75AihQloSWCXC5HDNgyinEnhaQ_4-gaMud_GF50elYXLlCToR9se9Z8z433U3KjM-3Yx7ptKkmQNAMggQwAVKgq3zYAoidNEWuxpkY_mAitTSRLnsJW-NCTa0bqBFF6Wm1MxgfE",
45
+ e: "AQAB",
46
+ },
47
+ { name: "RSA-OAEP", hash: "SHA-256" },
48
+ true,
49
+ ["encrypt"],
50
+ )
51
+
52
+ async function getCorrespondPath(timestamp) {
53
+ const data = new TextEncoder().encode(`refresh_${timestamp}`);
54
+ const encrypted = new Uint8Array(await crypto.subtle.encrypt({ name: "RSA-OAEP" }, publicKey, data))
55
+ return encrypted.reduce((str, c) => str + c.toString(16).padStart(2, "0"), "")
56
+ }
57
+
58
+ const ts = Date.now()
59
+ const correspondPath = await getCorrespondPath(ts)
60
+ const { data } = await this.client.get(`https://www.bilibili.com/correspond/1/${correspondPath}`)
61
+ // 创建一个虚拟的DOM元素
62
+ const { document } = new JSDOM(data).window;
63
+ // 提取标签name为1-name的内容
64
+ const targetElement = document.getElementById('1-name');
65
+ const refresh_csrf = targetElement ? targetElement.textContent : null;
66
+ // 获取csrf
67
+ let csrf: string
68
+ const cookies = JSON.parse(this.getCookies())
69
+ cookies.forEach(cookie => {
70
+ if (cookie.key === 'bili_jct') csrf = cookie.value
71
+ })
72
+ // 读取数据库获取cookies
73
+ const database = (await this.ctx.database.get('loginBili', 1))[0]
74
+ // 获取refreshToken
75
+ const refresh_token = this.ctx.wbi.decrypt(database.bili_refresh_token)
76
+ // 发送请求
77
+ const { data: refreshData } = await this.client.post('https://passport.bilibili.com/x/passport-login/web/cookie/refresh', {
78
+ csrf,
79
+ refresh_csrf,
80
+ source: 'main_web',
81
+ refresh_token
82
+ })
83
+ console.log(refreshData);
84
+ } */
38
85
  async getServerUTCTime() {
39
86
  try {
40
87
  const { data } = await this.client.get(GET_SERVER_UTC_TIME);
@@ -204,12 +251,28 @@ class BiliAPI extends koishi_1.Service {
204
251
  // restart plugin check
205
252
  this.checkIfTokenNeedRefresh(decryptedRefreshToken, csrf);
206
253
  // Open scheduled tasks and check if token need refresh
207
- this.ctx.setInterval(() => {
254
+ this.refreshCookieTimer = this.ctx.setInterval(() => {
208
255
  this.checkIfTokenNeedRefresh(decryptedRefreshToken, csrf);
209
256
  }, 43200000);
210
257
  }
211
258
  async checkIfTokenNeedRefresh(refreshToken, csrf, times = 0) {
259
+ // 定义数据
212
260
  let data;
261
+ // 定义方法
262
+ const notifyAndError = (info) => {
263
+ // 设置控制台通知
264
+ this.loginNotifier = this.ctx.notifier.create({
265
+ type: 'warning',
266
+ content: info
267
+ });
268
+ // 重置为未登录状态
269
+ this.createNewClient();
270
+ // 关闭定时器
271
+ this.refreshCookieTimer();
272
+ // 抛出错误
273
+ throw new Error(info);
274
+ };
275
+ // 尝试获取Cookieinfo
213
276
  try {
214
277
  const { data: cookieData } = await this.getCookieInfo(refreshToken);
215
278
  data = cookieData;
@@ -227,17 +290,21 @@ class BiliAPI extends koishi_1.Service {
227
290
  // 不需要刷新,直接返回
228
291
  if (!data.refresh)
229
292
  return;
293
+ // 定义Key
230
294
  const publicKey = await crypto.subtle.importKey("jwk", {
231
295
  kty: "RSA",
232
296
  n: "y4HdjgJHBlbaBN04VERG4qNBIFHP6a3GozCl75AihQloSWCXC5HDNgyinEnhaQ_4-gaMud_GF50elYXLlCToR9se9Z8z433U3KjM-3Yx7ptKkmQNAMggQwAVKgq3zYAoidNEWuxpkY_mAitTSRLnsJW-NCTa0bqBFF6Wm1MxgfE",
233
297
  e: "AQAB",
234
298
  }, { name: "RSA-OAEP", hash: "SHA-256" }, true, ["encrypt"]);
299
+ // 定义获取CorrespondPath方法
235
300
  async function getCorrespondPath(timestamp) {
236
301
  const data = new TextEncoder().encode(`refresh_${timestamp}`);
237
302
  const encrypted = new Uint8Array(await crypto.subtle.encrypt({ name: "RSA-OAEP" }, publicKey, data));
238
303
  return encrypted.reduce((str, c) => str + c.toString(16).padStart(2, "0"), "");
239
304
  }
240
- const correspondPath = await getCorrespondPath(data.timestamp);
305
+ // 获取CorrespondPath
306
+ const ts = Date.now();
307
+ const correspondPath = await getCorrespondPath(ts);
241
308
  // 获取refresh_csrf
242
309
  const { data: refreshCsrfHtml } = await this.client.get(`https://www.bilibili.com/correspond/1/${correspondPath}`);
243
310
  // 创建一个虚拟的DOM元素
@@ -247,19 +314,11 @@ class BiliAPI extends koishi_1.Service {
247
314
  const refresh_csrf = targetElement ? targetElement.textContent : null;
248
315
  // 发送刷新请求
249
316
  const { data: refreshData } = await this.client.post('https://passport.bilibili.com/x/passport-login/web/cookie/refresh', {
250
- csrf: csrf.trim(),
317
+ csrf,
251
318
  refresh_csrf,
252
319
  source: 'main_web',
253
320
  refresh_token: refreshToken
254
321
  });
255
- const notifyAndError = (info) => {
256
- // 设置控制台通知
257
- this.loginNotifier = this.ctx.notifier.create({
258
- type: 'warning',
259
- content: info
260
- });
261
- throw new Error(info);
262
- };
263
322
  // 检查是否有其他问题
264
323
  switch (refreshData.code) {
265
324
  // 账号未登录
@@ -283,12 +342,6 @@ class BiliAPI extends koishi_1.Service {
283
342
  }]);
284
343
  // Get new csrf from cookies
285
344
  let newCsrf;
286
- /* this.jar.store.getAllCookies((err, c) => {
287
- if (err) throw err;
288
- c.forEach(cookie => {
289
- if (cookie.key === 'bili_jct') newCsrf = cookie.value
290
- });
291
- }) */
292
345
  this.jar.serializeSync().cookies.forEach(cookie => {
293
346
  if (cookie.key === 'bili_jct')
294
347
  newCsrf = cookie.value;
@@ -4,6 +4,7 @@ declare class ComRegister {
4
4
  static inject: string[];
5
5
  logger: Logger;
6
6
  config: ComRegister.Config;
7
+ loginTimer: Function;
7
8
  num: number;
8
9
  subNotifier: Notifier;
9
10
  subManager: {
@@ -19,6 +20,7 @@ declare class ComRegister {
19
20
  qqBot: Bot<Context>;
20
21
  qqguildBot: Bot<Context>;
21
22
  oneBot: Bot<Context>;
23
+ redBot: Bot<Context>;
22
24
  constructor(ctx: Context, config: ComRegister.Config);
23
25
  dynamicDetect(ctx: Context, bot: Bot<Context>, guildId: string, uid: string): () => Promise<void>;
24
26
  liveDetect(ctx: Context, bot: Bot<Context>, guildId: string, roomId: string): () => Promise<string[]>;
@@ -32,6 +34,7 @@ declare class ComRegister {
32
34
  declare namespace ComRegister {
33
35
  interface Config {
34
36
  unlockSubLimits: boolean;
37
+ liveStartAtAll: boolean;
35
38
  pushTime: number;
36
39
  liveLoopTime: number;
37
40
  dynamicLoopTime: number;
@@ -17,6 +17,7 @@ class ComRegister {
17
17
  static inject = ['biliAPI', 'gimg', 'wbi', 'database'];
18
18
  logger;
19
19
  config;
20
+ loginTimer;
20
21
  num = 0;
21
22
  subNotifier;
22
23
  subManager = [];
@@ -26,15 +27,20 @@ class ComRegister {
26
27
  qqguildBot;
27
28
  // OneBot机器人
28
29
  oneBot;
30
+ // Red机器人
31
+ redBot;
29
32
  constructor(ctx, config) {
30
33
  this.logger = ctx.logger('commandRegister');
31
34
  this.config = config;
32
- // 拿到QQ群机器人
33
- this.qqBot = ctx.bots.find(bot => bot.platform === 'qq');
34
- // 拿到QQ频道机器人
35
- this.qqguildBot = ctx.bots.find(bot => bot.platform === 'qqguild');
36
- // 拿到OneBot机器人
37
- this.oneBot = ctx.bots.find(bot => bot.platform === 'onebot');
35
+ // 拿到各类机器人
36
+ ctx.bots.forEach(bot => {
37
+ switch (bot.platform) {
38
+ case 'qq': this.qqBot = bot;
39
+ case 'qqguild': this.qqguildBot = bot;
40
+ case 'onebot': this.oneBot = bot;
41
+ case ' red': this.redBot = bot;
42
+ }
43
+ });
38
44
  // 从数据库获取订阅
39
45
  this.getSubFromDatabase(ctx);
40
46
  /* const testCom = ctx.command('test', { hidden: true, permissions: ['authority:5'] })
@@ -44,7 +50,7 @@ class ComRegister {
44
50
  .action(async () => {
45
51
  this.logger.info('调用test cookies指令')
46
52
  // await ctx.biliAPI.loadCookiesFromDatabase()
47
- console.log(ctx.biliAPI.getCookies());
53
+ console.log(JSON.parse(ctx.biliAPI.getCookies()));
48
54
  })
49
55
 
50
56
  testCom
@@ -119,6 +125,14 @@ class ComRegister {
119
125
  .example('test utc')
120
126
  .action(async ({ session }) => {
121
127
  session.send((await ctx.biliAPI.getServerUTCTime()).toString())
128
+ })
129
+
130
+ testCom
131
+ .subcommand('.refresh')
132
+ .usage('测试cookie刷新方法')
133
+ .example('test refresh')
134
+ .action(async ({ session }) => {
135
+ ctx.biliAPI.test_refresh_token()
122
136
  }) */
123
137
  const biliCom = ctx.command('bili', 'bili-notify插件相关指令', { permissions: ['authority:3'] });
124
138
  biliCom.subcommand('.login', '登录B站之后才可以进行之后的操作')
@@ -136,7 +150,7 @@ class ComRegister {
136
150
  }
137
151
  // 判断是否出问题
138
152
  if (content.code !== 0)
139
- return await session.send('出问题咯,请联系管理员解决!');
153
+ return await session.send('出问题咯,请联系管理员解决');
140
154
  // 生成二维码
141
155
  qrcode_1.default.toBuffer(content.data.url, {
142
156
  errorCorrectionLevel: 'H', // 错误更正水平
@@ -148,48 +162,60 @@ class ComRegister {
148
162
  }
149
163
  }, async (err, buffer) => {
150
164
  if (err)
151
- return await session.send('二维码生成出错,请联系管理员解决!');
165
+ return await session.send('二维码生成出错,请重新尝试');
152
166
  await session.send(koishi_1.h.image(buffer, 'image/png'));
153
167
  });
154
- // 定义定时器
155
- let dispose;
168
+ // 检查之前是否存在登录定时器
169
+ this.loginTimer && this.loginTimer();
170
+ // 设置flag
171
+ let flag = true;
156
172
  // 发起登录请求检查登录状态
157
- dispose = ctx.setInterval(async () => {
158
- let loginContent;
173
+ this.loginTimer = ctx.setInterval(async () => {
159
174
  try {
160
- loginContent = await ctx.biliAPI.getLoginStatus(content.data.qrcode_key);
161
- }
162
- catch (e) {
163
- this.logger.error(e);
164
- return;
165
- }
166
- if (loginContent.code !== 0) {
167
- dispose();
168
- return await session.send('登录失败!请联系管理员解决!');
169
- }
170
- if (loginContent.data.code === 86038) {
171
- dispose();
172
- return await session.send('二维码已失效,请重新登录!');
175
+ // 判断上一个循环是否完成
176
+ if (!flag)
177
+ return;
178
+ flag = false;
179
+ // 获取登录信息
180
+ let loginContent;
181
+ try {
182
+ loginContent = await ctx.biliAPI.getLoginStatus(content.data.qrcode_key);
183
+ }
184
+ catch (e) {
185
+ this.logger.error(e);
186
+ return;
187
+ }
188
+ if (loginContent.code !== 0) {
189
+ this.loginTimer();
190
+ return await session.send('登录失败请联系管理员解决');
191
+ }
192
+ if (loginContent.data.code === 86038) {
193
+ this.loginTimer();
194
+ return await session.send('二维码已失效,请重新登录');
195
+ }
196
+ if (loginContent.data.code === 0) { // 登录成功
197
+ const encryptedCookies = ctx.wbi.encrypt(ctx.biliAPI.getCookies());
198
+ const encryptedRefreshToken = ctx.wbi.encrypt(loginContent.data.refresh_token);
199
+ await ctx.database.upsert('loginBili', [{
200
+ id: 1,
201
+ bili_cookies: encryptedCookies,
202
+ bili_refresh_token: encryptedRefreshToken
203
+ }]);
204
+ // 销毁定时器
205
+ this.loginTimer();
206
+ // 订阅之前的订阅
207
+ await this.getSubFromDatabase(ctx);
208
+ // 清除控制台通知
209
+ ctx.biliAPI.disposeNotifier();
210
+ // 发送成功登录推送
211
+ await session.send('登录成功');
212
+ // bili show
213
+ await session.execute('bili show');
214
+ return;
215
+ }
173
216
  }
174
- if (loginContent.data.code === 0) { // 登录成功
175
- const encryptedCookies = ctx.wbi.encrypt(ctx.biliAPI.getCookies());
176
- const encryptedRefreshToken = ctx.wbi.encrypt(loginContent.data.refresh_token);
177
- await ctx.database.upsert('loginBili', [{
178
- id: 1,
179
- bili_cookies: encryptedCookies,
180
- bili_refresh_token: encryptedRefreshToken
181
- }]);
182
- // 销毁定时器
183
- dispose();
184
- // 订阅之前的订阅
185
- await this.getSubFromDatabase(ctx);
186
- // 清除控制台通知
187
- ctx.biliAPI.disposeNotifier();
188
- // 发送成功登录推送
189
- await session.send('登录成功!');
190
- // bili show
191
- await session.execute('bili show');
192
- return;
217
+ finally {
218
+ flag = true;
193
219
  }
194
220
  }, 1000);
195
221
  });
@@ -314,11 +340,12 @@ class ComRegister {
314
340
  if (!liveMsg && !dynamicMsg) {
315
341
  return '您未订阅该UP的任何消息';
316
342
  }
317
- // 设置群号
318
- if (!guildId) { // 没有输入群号,默认当前聊天环境
343
+ // 设置频道号
344
+ if (!guildId) { // 没有输入频道号,默认当前聊天环境
319
345
  switch (session.event.platform) {
320
- case 'qqguild':
346
+ case 'red':
321
347
  case 'onebot':
348
+ case 'qqguild':
322
349
  guildId = session.event.channel.id;
323
350
  break;
324
351
  case 'qq':
@@ -328,7 +355,7 @@ class ComRegister {
328
355
  }
329
356
  }
330
357
  else {
331
- return '暂不支持群号发送!';
358
+ return '暂不支持群号发送';
332
359
  }
333
360
  // 保存到数据库中
334
361
  const sub = await ctx.database.create('bilibili', {
@@ -412,6 +439,9 @@ class ComRegister {
412
439
  case 'onebot':
413
440
  bot = this.oneBot;
414
441
  break;
442
+ case 'red':
443
+ bot = this.redBot;
444
+ break;
415
445
  default: return '非法调用';
416
446
  }
417
447
  // 开始循环检测
@@ -450,6 +480,9 @@ class ComRegister {
450
480
  case 'onebot':
451
481
  bot = this.oneBot;
452
482
  break;
483
+ case 'red':
484
+ bot = this.redBot;
485
+ break;
453
486
  default: return '非法调用';
454
487
  }
455
488
  // 开始循环检测
@@ -484,10 +517,10 @@ class ComRegister {
484
517
  // B站出问题了
485
518
  if (content.code !== 0) {
486
519
  if (content.msg === '未找到该房间') {
487
- session.send('未找到该房间!');
520
+ session.send('未找到该房间');
488
521
  }
489
522
  else {
490
- session.send('未知错误,请呼叫管理员检查问题!');
523
+ session.send('未知错误,请呼叫管理员检查问题');
491
524
  }
492
525
  return;
493
526
  }
@@ -554,14 +587,6 @@ class ComRegister {
554
587
  this.logger.info(`items[${num}].modules.module_author.pub_ts: ${ctx.gimg.unixTimestampToString(items[num].modules.module_author.pub_ts)}`) */
555
588
  // 寻找发布时间比时间点更晚的动态
556
589
  if (items[num].modules.module_author.pub_ts > timePoint) {
557
- // 更新时间点为当前动态的发布时间
558
- /* if (num === 1) { // 寻找倒数第二条动态
559
- if (items[0].modules.module_tag) { // 存在置顶动态
560
- timePoint = items[num].modules.module_author.pub_ts
561
- } else {
562
- timePoint = items[0].modules.module_author.pub_ts
563
- }
564
- } */
565
590
  // 推送该条动态
566
591
  let attempts = 3;
567
592
  for (let i = 0; i < attempts; i++) {
@@ -571,6 +596,7 @@ class ComRegister {
571
596
  let buffer;
572
597
  // 获取动态推送图片
573
598
  try {
599
+ // 渲染图片
574
600
  const { pic: gimgPic, buffer: gimgBuffer } = await ctx.gimg.generateDynamicImg(items[num]);
575
601
  pic = gimgPic;
576
602
  buffer = gimgBuffer;
@@ -612,22 +638,6 @@ class ComRegister {
612
638
  }
613
639
  case 0: timePoint = items[num].modules.module_author.pub_ts;
614
640
  }
615
- // 如果这是遍历的最后一条,将时间点设置为这条动态的发布时间
616
- /* if (num === 1) timePoint = items[num].modules.module_author.pub_ts
617
- if (num === 0) {
618
- timePoint = items[num].modules.module_author.pub_ts
619
- } */
620
- // 检查最一条动态是否是置顶动态 (ver 1.0.4 不用考虑置顶动态的问题)
621
- // 如果是新发布的置顶动态,直接推送即可。如果是旧的置顶动态,则无法进入这个判断
622
- /* if (num === 0) {
623
- // 如果是置顶动态,则跳过
624
- if (items[num].modules.module_tag) {
625
- // 将上一条动态的发布时间设为时间点
626
- timePoint = items[num + 1].modules.module_author.pub_ts
627
- continue
628
- }
629
- timePoint = items[num].modules.module_author.pub_ts
630
- } */
631
641
  }
632
642
  }
633
643
  };
@@ -652,6 +662,8 @@ class ComRegister {
652
662
  return bot.sendMessage(guildId, pic);
653
663
  // pic不存在,说明使用的是page模式
654
664
  await bot.sendMessage(guildId, koishi_1.h.image(buffer, 'image/png'));
665
+ // 成功则跳出循环
666
+ break;
655
667
  }
656
668
  catch (e) {
657
669
  this.logger.error('liveDetect generateLiveImg() 推送卡片发送失败');
@@ -672,7 +684,10 @@ class ComRegister {
672
684
  let attempts = 3;
673
685
  for (let i = 0; i < attempts; i++) {
674
686
  try {
687
+ // 发送请求获取room信息
675
688
  content = await ctx.biliAPI.getLiveRoomInfo(roomId);
689
+ // 成功则跳出循环
690
+ break;
676
691
  }
677
692
  catch (e) {
678
693
  this.logger.error('liveDetect getLiveRoomInfo 网络请求失败');
@@ -701,8 +716,11 @@ class ComRegister {
701
716
  let attempts = 3;
702
717
  for (let i = 0; i < attempts; i++) {
703
718
  try {
719
+ // 发送请求获取主播信息
704
720
  const { data: userInfo } = await ctx.biliAPI.getMasterInfo(data.uid);
705
721
  userData = userInfo;
722
+ // 成功则跳出循环
723
+ break;
706
724
  }
707
725
  catch (e) {
708
726
  this.logger.error('liveDetect getMasterInfo() 本次网络请求失败');
@@ -750,8 +768,11 @@ class ComRegister {
750
768
  let attempts = 3;
751
769
  for (let i = 0; i < attempts; i++) {
752
770
  try {
771
+ // 获取主播信息
753
772
  const { data: userInfo } = await ctx.biliAPI.getMasterInfo(data.uid);
754
773
  userData = userInfo;
774
+ // 成功则跳出循环
775
+ break;
755
776
  }
756
777
  catch (e) {
757
778
  this.logger.error('liveDetect open getMasterInfo() 网络请求错误');
@@ -764,6 +785,11 @@ class ComRegister {
764
785
  uData = userData;
765
786
  // 发送直播通知卡片
766
787
  sendLiveNotifyCard(data, uData, LiveType.StartBroadcasting);
788
+ // 判断是否需要@全体成员
789
+ if (this.config.liveStartAtAll) {
790
+ // 发送@全体成员通知
791
+ bot.sendMessage(guildId, (0, jsx_runtime_1.jsx)("at", { type: "all" }));
792
+ }
767
793
  }
768
794
  else { // 还在直播
769
795
  if (this.config.pushTime > 0) {
@@ -809,7 +835,7 @@ class ComRegister {
809
835
  session.send(`是否需要订阅${subType}?需要输入 y 不需要输入 n `);
810
836
  input = await session.prompt();
811
837
  if (!input) {
812
- await session.send('输入超时!请重新订阅');
838
+ await session.send('输入超时请重新订阅');
813
839
  continue;
814
840
  }
815
841
  switch (input) {
@@ -892,6 +918,9 @@ class ComRegister {
892
918
  case 'onebot':
893
919
  bot = this.oneBot;
894
920
  break;
921
+ case 'red':
922
+ bot = this.redBot;
923
+ break;
895
924
  default: {
896
925
  // 本条数据被篡改,删除该条订阅
897
926
  ctx.database.remove('bilibili', { id: sub.id });
@@ -906,6 +935,7 @@ class ComRegister {
906
935
  for (let i = 0; i < attempts; i++) {
907
936
  try {
908
937
  content = await ctx.biliAPI.getUserInfo(sub.uid);
938
+ // 成功则跳出循环
909
939
  break;
910
940
  }
911
941
  catch (e) {
@@ -1050,6 +1080,7 @@ class ComRegister {
1050
1080
  (function (ComRegister) {
1051
1081
  ComRegister.Config = koishi_1.Schema.object({
1052
1082
  unlockSubLimits: koishi_1.Schema.boolean().required(),
1083
+ liveStartAtAll: koishi_1.Schema.boolean().required(),
1053
1084
  pushTime: koishi_1.Schema.number().required(),
1054
1085
  liveLoopTime: koishi_1.Schema.number().default(10),
1055
1086
  dynamicLoopTime: koishi_1.Schema.number().default(60),
package/lib/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface Config {
6
6
  key: string;
7
7
  basicSettings: {};
8
8
  unlockSubLimits: boolean;
9
+ liveStartAtAll: boolean;
9
10
  pushTime: number;
10
11
  dynamicCheckNumber: number;
11
12
  dynamicLoopTime: '1分钟' | '2分钟' | '3分钟' | '5分钟';
package/lib/index.js CHANGED
@@ -49,6 +49,10 @@ exports.Config = koishi_1.Schema.object({
49
49
  unlockSubLimits: koishi_1.Schema.boolean()
50
50
  .default(false)
51
51
  .description('解锁3个订阅限制,默认只允许订阅3位UP主。订阅过多用户可能有导致IP暂时被封禁的风险'),
52
+ liveStartAtAll: koishi_1.Schema.boolean()
53
+ .default(false)
54
+ .experimental()
55
+ .description('直播开始时艾特全体成员,默认关闭'),
52
56
  pushTime: koishi_1.Schema.number()
53
57
  .min(0)
54
58
  .max(12)
@@ -61,7 +65,7 @@ exports.Config = koishi_1.Schema.object({
61
65
  .role('slider')
62
66
  .step(1)
63
67
  .default(5)
64
- .description('设定每次检查动态的数量。若订阅的UP主经常在短时间内连着发多条动态可以将该值提高,若订阅的UP主有置顶动态,在计算该值时应-1。默认值为5条'),
68
+ .description('设定每次检查动态的数量。若订阅的UP主经常在短时间内连着发多条动态可以将该值提高,若订阅的UP主有置顶动态,在计算该值时应+1。默认值为5条'),
65
69
  dynamicLoopTime: koishi_1.Schema.union(['1分钟', '2分钟', '3分钟', '5分钟'])
66
70
  .role('')
67
71
  .default('2分钟')
@@ -163,6 +167,7 @@ function apply(ctx, config) {
163
167
  // ctx.plugin(Authority)
164
168
  ctx.plugin(comRegister_1.default, {
165
169
  unlockSubLimits: config.unlockSubLimits,
170
+ liveStartAtAll: config.liveStartAtAll,
166
171
  pushTime: config.pushTime,
167
172
  dynamicCheckNumber: config.dynamicCheckNumber,
168
173
  dynamicLoopTime
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": "1.0.12",
4
+ "version": "1.0.14",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -87,6 +87,9 @@
87
87
  - ver 1.0.9 更新请求客户端header信息。优化了动态推送卡片的页面布局,增加了字体大小。提供用户开放订阅数量限制的选项,提供用户移除推送卡片边框的选项。在控制台页面增加订阅信息提示
88
88
  - ver 1.0.10 增加对onebot的支持,添加动态关键字屏蔽功能
89
89
  - ver 1.0.11 修复了render渲染模式下,动态重复推送的问题,修复了没有订阅时,控制台空白提示的问题。优化了视频动态缩略图显示不全的问题,优化了部分逻辑。增强容错和增加错误提示
90
+ - ver 1.0.12 提供用户选择动态推送卡片字体增大的选项
91
+ - ver 1.0.13 修复了直播通知卡片连续发三次的bug,修复了多次调用指令 `bili login` 产生的bug
92
+ - ver 1.0.14 修复了获取二维码,二维码失效后会多次发生提示的bug,新增对red的支持,新增开播艾特全体成员功能,优化了部分逻辑
90
93
 
91
94
  ## 感谢
92
95