koishi-plugin-bilibili-notify 2.0.0-alpha.11 → 2.0.0-alpha.13

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.
@@ -198,6 +198,8 @@
198
198
  - ver 2.0.0-alpha.9 修复:订阅反复提示未加入群组的bug,实际已加入
199
199
  - ver 2.0.0-alpha.10 新增:可对每个群聊针对性设置是否艾特全体成员 优化:直播下播通知
200
200
  - ver 2.0.0-alpha.11 回档:订阅时可直接接收群号/频道号 修复:直播过程推送消息不成功的bug
201
+ - ver 2.0.0-alpha.12 更改:开启艾特全体成员后,只有在开播时才艾特全体成员
202
+ - ver 2.0.0-alpha.13 修复:无法对TG群组的特殊频道号进行订阅处理;提示 `您未配置对应平台的机器人,不能在该平台进行订阅操作` 仍进行订阅操作
201
203
 
202
204
  ## 交流群
203
205
 
@@ -293,7 +293,7 @@ class ComRegister {
293
293
  });
294
294
  biliCom
295
295
  .subcommand('.sub <mid:string> [...groupId:string]', '订阅用户动态和直播通知')
296
- .option('multiplatform', '-m <value:string>', { type: /^[A-Za-z0-9]+@?(?:,[A-Za-z0-9]+@?)*\.[A-Za-z0-9]+(?:;[A-Za-z0-9]+@?(?:,[A-Za-z0-9]+@?)*\.[A-Za-z0-9]+)*$/ })
296
+ .option('multiplatform', '-m <value:string>', { type: /^(-?[a-zA-Z0-9]+@?[a-zA-Z0-9]*\.[a-zA-Z0-9]+(?:,-?[a-zA-Z0-9]+@?[a-zA-Z0-9]*\.[a-zA-Z0-9]+)*)(;(-?[a-zA-Z0-9]+@?[a-zA-Z0-9]*\.[a-zA-Z0-9]+(?:,-?[a-zA-Z0-9]+@?[a-zA-Z0-9]*\.[a-zA-Z0-9]+)*))*$/ })
297
297
  .option('live', '-l')
298
298
  .option('dynamic', '-d')
299
299
  .option('atAll', '-a')
@@ -344,13 +344,16 @@ class ComRegister {
344
344
  }
345
345
  // 判断是否使用了多平台
346
346
  if (target) {
347
- target.forEach(async ({ channelIdArr, platform }, index) => {
347
+ for (const [index, { channelIdArr, platform }] of target.entries()) {
348
348
  if (channelIdArr.length > 0) { // 输入了推送群号或频道号
349
349
  // 拿到对应的bot
350
350
  const bot = this.getBot(ctx, platform);
351
351
  // 判断是否配置了对应平台的机器人
352
352
  if (!ctx.bots.some(bot => bot.platform === platform)) {
353
+ // 发送提示消息
353
354
  await session.send('您未配置对应平台的机器人,不能在该平台进行订阅操作');
355
+ // 直接返回
356
+ return;
354
357
  }
355
358
  // 判断是否需要加入的群全部推送
356
359
  if (channelIdArr[0].channelId !== 'all') {
@@ -399,7 +402,7 @@ class ComRegister {
399
402
  // 发送提示消息
400
403
  await session.send('没有填写群号或频道号,默认订阅到当前聊天环境');
401
404
  }
402
- });
405
+ }
403
406
  }
404
407
  else {
405
408
  // 用户直接订阅,将当前环境赋值给target
@@ -1065,11 +1068,21 @@ class ComRegister {
1065
1068
  // pic 存在,使用的是render模式
1066
1069
  if (pic) {
1067
1070
  const msg = liveNotifyMsg ? liveNotifyMsg : '';
1068
- return await this.sendMsg(ctx, target, pic + msg, true);
1071
+ // 只有在开播时才艾特全体成员
1072
+ if (liveType === LiveType.StartBroadcasting) {
1073
+ return await this.sendMsg(ctx, target, pic + msg, true);
1074
+ }
1075
+ // 正常不需要艾特全体成员
1076
+ return await this.sendMsg(ctx, target, pic + msg);
1069
1077
  }
1070
1078
  // pic不存在,说明使用的是page模式
1071
1079
  const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), liveNotifyMsg && liveNotifyMsg] });
1072
- await this.sendMsg(ctx, target, msg, true);
1080
+ // 只有在开播时才艾特全体成员
1081
+ if (liveType === LiveType.StartBroadcasting) {
1082
+ return await this.sendMsg(ctx, target, msg, true);
1083
+ }
1084
+ // 正常不需要艾特全体成员
1085
+ return await this.sendMsg(ctx, target, msg);
1073
1086
  };
1074
1087
  // 定义获取主播信息方法
1075
1088
  let useMasterInfo;
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": "2.0.0-alpha.11",
4
+ "version": "2.0.0-alpha.13",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],