koishi-plugin-bilibili-notify 1.2.3-rc.8 → 1.2.3-rc.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.
@@ -360,7 +360,7 @@ class ComRegister {
360
360
  content = await ctx.biliAPI.getUserInfo(mid);
361
361
  }
362
362
  catch (e) {
363
- return 'bili sub getUserInfo() 本次网络请求失败,请重试';
363
+ return 'bili sub getUserInfo() 发生了错误,错误为:' + e.toString();
364
364
  }
365
365
  // 判断是否有其他问题
366
366
  if (content.code !== 0) {
@@ -378,7 +378,9 @@ class ComRegister {
378
378
  case -352:
379
379
  msg = '请登录后再尝试订阅';
380
380
  break;
381
- default: msg = '未知错误,请联系管理员';
381
+ default:
382
+ msg = '未知错误,错误信息:' + content.message;
383
+ break;
382
384
  }
383
385
  return msg;
384
386
  }
@@ -495,7 +497,7 @@ class ComRegister {
495
497
  userData = data;
496
498
  }
497
499
  catch (e) {
498
- this.logger.error('bili sub指令 getMasterInfo() 网络请求失败,原因:' + e.toString());
500
+ this.logger.error('bili sub指令 getMasterInfo() 发生了错误,错误为:' + e.toString());
499
501
  return '订阅出错啦,请重试';
500
502
  }
501
503
  // 需要订阅直播
@@ -571,7 +573,7 @@ class ComRegister {
571
573
  content = await ctx.biliAPI.getLiveRoomInfo(roomId);
572
574
  }
573
575
  catch (e) {
574
- return 'bili status指令 getLiveRoomInfo() 本次网络请求失败';
576
+ return 'bili status指令 getLiveRoomInfo() 发生了错误,错误为:' + e.toString();
575
577
  }
576
578
  const { data } = content;
577
579
  let userData;
@@ -580,7 +582,7 @@ class ComRegister {
580
582
  userData = userInfo;
581
583
  }
582
584
  catch (e) {
583
- return 'bili status指令 getMasterInfo() 网络请求失败';
585
+ return 'bili status指令 getMasterInfo() 发生了错误,错误为:' + e.toString();
584
586
  }
585
587
  // B站出问题了
586
588
  if (content.code !== 0) {
@@ -588,7 +590,7 @@ class ComRegister {
588
590
  session.send('未找到该房间');
589
591
  }
590
592
  else {
591
- session.send('未知错误');
593
+ session.send('未知错误,错误信息为:' + content.message);
592
594
  }
593
595
  return;
594
596
  }
@@ -626,42 +628,42 @@ class ComRegister {
626
628
  // 发送提示
627
629
  await session.send('已发送消息,如未收到则说明您的机器人不支持发送私聊消息或您的信息填写有误');
628
630
  });
629
- biliCom
631
+ /* biliCom
630
632
  .subcommand('.reboot', '测试插件自动重启功能', { hidden: true })
631
633
  .usage('测试插件自动重启功能')
632
634
  .example('bili reboot 测试插件自动重启功能')
633
635
  .action(async ({ session }) => {
634
- // 发送提示消息
635
- await session.send('测试biliAPI等服务自动重启功能');
636
- // 获得对应bot
637
- const bot = this.getTheCorrespondingBotBasedOnTheSession(session);
638
- // 发送提示消息,重启服务
639
- await this.sendPrivateMsgAndRebootService(ctx, bot, '测试biliAPI等服务自动重启功能');
640
- });
641
- biliCom
636
+ // 发送提示消息
637
+ await session.send('测试biliAPI等服务自动重启功能')
638
+ // 获得对应bot
639
+ const bot = this.getTheCorrespondingBotBasedOnTheSession(session)
640
+ // 发送提示消息,重启服务
641
+ await this.sendPrivateMsgAndRebootService(ctx, bot, '测试biliAPI等服务自动重启功能')
642
+ }) */
643
+ /* biliCom
642
644
  .subcommand('.sendall', '测试给机器人加入的所有群发送消息', { hidden: true })
643
645
  .usage('测试给机器人加入的所有群发送消息')
644
646
  .example('bili sendall 测试给机器人加入的所有群发送消息')
645
647
  .action(async ({ session }) => {
646
- // 获得对应bot
647
- const bot = this.getTheCorrespondingBotBasedOnTheSession(session);
648
- // 发送消息
649
- await this.sendMsg(ctx, ['all'], bot, 'Hello World');
650
- // 发送提示
651
- await session.send('已向机器人加入的所有群发送了消息');
652
- });
653
- biliCom
648
+ // 获得对应bot
649
+ const bot = this.getTheCorrespondingBotBasedOnTheSession(session)
650
+ // 发送消息
651
+ await this.sendMsg(ctx, ['all'], bot, 'Hello World')
652
+ // 发送提示
653
+ await session.send('已向机器人加入的所有群发送了消息')
654
+ }) */
655
+ /* biliCom
654
656
  .subcommand('.list', '获取机器人加入的所有群组', { hidden: true })
655
657
  .usage('获取当前机器人加入的所有群聊')
656
658
  .example('bili list 获取当前机器人加入的所有群聊')
657
659
  .action(async ({ session }) => {
658
- // 获取对应Bot
659
- const bot = this.getTheCorrespondingBotBasedOnTheSession(session);
660
- // 获取群列表
661
- const guildList = (await bot.getGuildList()).data;
662
- // 遍历群列表
663
- guildList.map(item => this.logger.info(`已加入${item.id}`));
664
- });
660
+ // 获取对应Bot
661
+ const bot = this.getTheCorrespondingBotBasedOnTheSession(session)
662
+ // 获取群列表
663
+ const guildList = (await bot.getGuildList()).data
664
+ // 遍历群列表
665
+ guildList.map(item => this.logger.info(`已加入${item.id}`))
666
+ }) */
665
667
  }
666
668
  getTheCorrespondingBotBasedOnTheSession(session) {
667
669
  // 获取对应Bot
@@ -767,7 +769,7 @@ class ComRegister {
767
769
  content = await ctx.biliAPI.getUserSpaceDynamic(uid);
768
770
  }
769
771
  catch (e) {
770
- return this.logger.error('dynamicDetect getUserSpaceDynamic() 网络请求失败');
772
+ return this.logger.error('dynamicDetect getUserSpaceDynamic() 发生了错误,错误为:' + e.toString());
771
773
  }
772
774
  // 判断是否出现其他问题
773
775
  if (content.code !== 0) {
@@ -776,7 +778,7 @@ class ComRegister {
776
778
  await this.sendPrivateMsg(bot, '账号未登录,请登录后重新订阅动态');
777
779
  break;
778
780
  }
779
- default: await this.sendPrivateMsg(bot, '未知错误,请重新订阅动态'); // 未知错误
781
+ default: await this.sendPrivateMsg(bot, '获取动态信息错误,错误为:' + content.message); // 未知错误
780
782
  }
781
783
  // 取消订阅
782
784
  this.unsubSingle(ctx, uid, 1); /* 1为取消动态订阅 */
@@ -921,7 +923,7 @@ class ComRegister {
921
923
  break;
922
924
  }
923
925
  catch (e) {
924
- this.logger.error('liveDetect getLiveRoomInfo 网络请求失败');
926
+ this.logger.error('liveDetect getLiveRoomInfo 发生了错误,错误为:' + e.toString());
925
927
  if (i === attempts - 1) { // 已尝试三次
926
928
  return await this.sendPrivateMsgAndRebootService(ctx, bot, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
927
929
  }
@@ -943,7 +945,7 @@ class ComRegister {
943
945
  break;
944
946
  }
945
947
  catch (e) {
946
- this.logger.error('liveDetect getMasterInfo() 本次网络请求失败');
948
+ this.logger.error('liveDetect getMasterInfo() 发生了错误,错误为:' + e.toString());
947
949
  if (i === attempts - 1) { // 已尝试三次
948
950
  return await this.sendPrivateMsgAndRebootService(ctx, bot, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
949
951
  }
@@ -999,7 +1001,7 @@ class ComRegister {
999
1001
  break;
1000
1002
  }
1001
1003
  catch (e) {
1002
- this.logger.error('liveDetect open getMasterInfo() 网络请求错误');
1004
+ this.logger.error('liveDetect open getMasterInfo() 发生了错误,错误为:' + e.toString());
1003
1005
  if (i === attempts - 1) { // 已尝试三次
1004
1006
  return await this.sendPrivateMsgAndRebootService(ctx, bot, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
1005
1007
  }
@@ -1206,7 +1208,7 @@ class ComRegister {
1206
1208
  break;
1207
1209
  }
1208
1210
  catch (e) {
1209
- this.logger.error('getSubFromDatabase() getUserInfo() 本次网络请求失败');
1211
+ this.logger.error('getSubFromDatabase() getUserInfo() 发生了错误,错误为:' + e.toString());
1210
1212
  if (i === attempts - 1) { // 已尝试三次
1211
1213
  return await this.sendPrivateMsgAndRebootService(ctx, bot, '你的网络可能出现了某些问题,请检查后重启插件');
1212
1214
  }
package/lib/database.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.name = void 0;
4
- exports.apply = apply;
3
+ exports.apply = exports.name = void 0;
5
4
  exports.name = 'Database';
6
5
  function apply(ctx) {
7
6
  // 新增LoginBili表
@@ -23,3 +22,4 @@ function apply(ctx) {
23
22
  time: 'timestamp'
24
23
  }, { autoInc: true });
25
24
  }
25
+ exports.apply = apply;
package/lib/index.js CHANGED
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Config = exports.name = exports.inject = void 0;
30
- exports.apply = apply;
29
+ exports.apply = exports.Config = exports.name = exports.inject = void 0;
31
30
  const koishi_1 = require("koishi");
32
31
  // import plugins
33
32
  // import Authority from './authority'
@@ -244,3 +243,4 @@ function apply(ctx, config) {
244
243
  }
245
244
  });
246
245
  }
246
+ exports.apply = apply;
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.2.3-rc.8",
4
+ "version": "1.2.3-rc.9",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -133,6 +133,7 @@
133
133
  - ver 1.2.3-rc.6 bug测试版本,请跳过
134
134
  - ver 1.2.3-rc.7 尝试修复多群推送时部分群未推送的bug
135
135
  - ver 1.2.3-rc.8 修复在 `1.2.3-rc.7` 版本引入的连续推送三次的bug
136
+ - ver 1.2.3-rc.9 完善了插件出错时的日志输出
136
137
 
137
138
  ## 交流群
138
139