koishi-plugin-bilibili-notify 2.0.0-alpha.3 → 2.0.0-alpha.5

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.
@@ -181,6 +181,8 @@
181
181
  - ver 2.0.0-alpha.1 修复:无法成功取消订阅自己、用户没有直播间订阅直播出错。对直播订阅进行了限制,继承自以前的unlockSubLimits配置项。优化了一些配置项
182
182
  - ver 2.0.0-alpha.2 新增:支持Discord平台。优化了下播通知
183
183
  - ver 2.0.0-alpha.3 修复:订阅和取消订阅的bug,下播通知的bug
184
+ - ver 2.0.0-alpha.4 修复:初次订阅后不推送动态的bug 优化:下播不再发送链接
185
+ - ver 2.0.0-alpha.5 移除:选项pushUrl,选项platform 新增:选项customLive,主人账号中platform选项。支持多平台,且可同时推送不同平台,单个UP主只能推送一个平台
184
186
 
185
187
  ## 交流群
186
188
 
@@ -22,17 +22,18 @@ declare class ComRegister {
22
22
  subNotifier: Notifier;
23
23
  subManager: SubManager;
24
24
  loginDBData: FlatPick<LoginBili, "dynamic_group_id">;
25
- bot: Bot<Context>;
25
+ privateBot: Bot<Context>;
26
26
  dynamicDispose: Function;
27
- sendMsgFunc: (guild: string, content: any) => Promise<void>;
27
+ sendMsgFunc: (bot: Bot<Context, any>, guild: string, content: any) => Promise<void>;
28
28
  constructor(ctx: Context, config: ComRegister.Config);
29
+ getBot(ctx: Context, pf: string): Bot<Context, any>;
29
30
  sendPrivateMsg(content: string): Promise<void>;
30
31
  sendPrivateMsgAndRebootService(ctx: Context): Promise<void>;
31
32
  sendPrivateMsgAndStopService(ctx: Context): Promise<void>;
32
- sendMsg(targets: Array<string>, content: any): Promise<void>;
33
+ sendMsg(ctx: Context, targets: Array<string>, content: any, platform: string): Promise<void>;
33
34
  dynamicDetect(ctx: Context): () => Promise<void>;
34
35
  debug_dynamicDetect(ctx: Context): () => Promise<void>;
35
- liveDetect(ctx: Context, roomId: string, guildId: Array<string>): () => Promise<void>;
36
+ liveDetect(ctx: Context, roomId: string, guildId: Array<string>, platform: string): () => Promise<void>;
36
37
  subShow(): string;
37
38
  checkIfNeedSub(liveSub: boolean, dynamicSub: boolean, session: Session, data?: any): Promise<Array<boolean>>;
38
39
  updateSubNotifier(ctx: Context): void;
@@ -49,9 +50,9 @@ declare class ComRegister {
49
50
  }
50
51
  declare namespace ComRegister {
51
52
  interface Config {
52
- platform: string;
53
53
  master: {
54
54
  enable: boolean;
55
+ platform: string;
55
56
  masterAccount: string;
56
57
  masterAccountGuildId: string;
57
58
  };
@@ -60,10 +61,10 @@ declare namespace ComRegister {
60
61
  changeMasterInfoApi: boolean;
61
62
  liveStartAtAll: boolean;
62
63
  restartPush: boolean;
63
- pushUrl: boolean;
64
64
  pushTime: number;
65
65
  liveLoopTime: number;
66
66
  customLiveStart: string;
67
+ customLive: string;
67
68
  customLiveEnd: string;
68
69
  dynamicUrl: boolean;
69
70
  dynamicLoopTime: number;
@@ -29,7 +29,7 @@ class ComRegister {
29
29
  // 检查登录数据库是否有数据
30
30
  loginDBData;
31
31
  // 机器人实例
32
- bot;
32
+ privateBot;
33
33
  // 动态销毁函数
34
34
  dynamicDispose;
35
35
  // 发送消息方式
@@ -38,14 +38,13 @@ class ComRegister {
38
38
  constructor(ctx, config) {
39
39
  this.logger = ctx.logger('cr');
40
40
  this.config = config;
41
- // 拿到机器人实例
42
- this.bot = ctx.bots.find(bot => bot.platform === config.platform);
43
- if (!this.bot) {
41
+ // 拿到私人机器人实例
42
+ this.privateBot = ctx.bots.find(bot => bot.platform === config.master.platform);
43
+ if (!this.privateBot) {
44
44
  ctx.notifier.create({
45
- type: 'danger',
46
- content: '未找到对应机器人实例,请检查配置是否正确或重新配置适配器!'
45
+ content: '您未配置私人机器人,将无法向您推送机器人状态!'
47
46
  });
48
- this.logger.error('未找到对应机器人实例,请检查配置是否正确或重新配置适配器!');
47
+ this.logger.error('您未配置私人机器人,将无法向您推送机器人状态!');
49
48
  }
50
49
  // 检查登录数据库是否有数据
51
50
  ctx.database.get('loginBili', 1, ['dynamic_group_id']).then(data => this.loginDBData = data[0]);
@@ -53,13 +52,13 @@ class ComRegister {
53
52
  this.getSubFromDatabase(ctx);
54
53
  // 判断消息发送方式
55
54
  if (config.automaticResend) {
56
- this.sendMsgFunc = async (guild, content) => {
55
+ this.sendMsgFunc = async (bot, guild, content) => {
57
56
  // 多次尝试发送消息
58
57
  const attempts = 3;
59
58
  for (let i = 0; i < attempts; i++) {
60
59
  try {
61
60
  // 发送消息
62
- await this.bot.sendMessage(guild, content);
61
+ await bot.sendMessage(guild, content);
63
62
  // 防止消息发送速度过快被忽略
64
63
  await ctx.sleep(500);
65
64
  // 成功发送消息,跳出循环
@@ -76,10 +75,10 @@ class ComRegister {
76
75
  };
77
76
  }
78
77
  else {
79
- this.sendMsgFunc = async (guild, content) => {
78
+ this.sendMsgFunc = async (bot, guild, content) => {
80
79
  try {
81
80
  // 发送消息
82
- await this.bot.sendMessage(guild, content);
81
+ await bot.sendMessage(guild, content);
83
82
  }
84
83
  catch (e) {
85
84
  this.logger.error(`发送群组ID:${guild}消息失败!原因: ` + e.message);
@@ -103,7 +102,7 @@ class ComRegister {
103
102
  .usage('查看订阅管理对象')
104
103
  .example('status sm')
105
104
  .action(async () => {
106
- console.log(this.subManager);
105
+ this.logger.info(this.subManager);
107
106
  return '查看控制台';
108
107
  });
109
108
  const biliCom = ctx.command('bili', 'bili-notify插件相关指令', { permissions: ['authority:3'] });
@@ -282,19 +281,6 @@ class ComRegister {
282
281
  if (options.live && !this.config.unlockSubLimits && (this.subManager.reduce((acc, cur) => acc + (cur.live ? 1 : 0), 0) >= 3)) {
283
282
  return '直播订阅已达上限,请取消部分直播订阅后再进行订阅';
284
283
  }
285
- // 检查是否是不支持的平台
286
- switch (session.event.platform) {
287
- case 'lark':
288
- case 'red':
289
- case 'onebot':
290
- case 'telegram':
291
- case 'satori':
292
- case 'chronocat':
293
- case 'qq':
294
- case 'qqguild':
295
- case 'discord': break;
296
- default: return '暂不支持该平台';
297
- }
298
284
  // 检查是否登录
299
285
  if (!(await this.checkIfIsLogin(ctx))) {
300
286
  // 未登录直接返回
@@ -303,7 +289,11 @@ class ComRegister {
303
289
  // 检查必选参数是否已填
304
290
  if (!mid)
305
291
  return '请输入用户uid';
306
- // 订阅对象 TODO
292
+ // 订阅对象
293
+ const subUserData = await this.subUserInBili(ctx, mid);
294
+ // 判断是否订阅对象存在
295
+ if (!subUserData.flag)
296
+ return '订阅对象失败,请稍后重试!';
307
297
  // 定义外围变量
308
298
  let content;
309
299
  try {
@@ -390,8 +380,10 @@ class ComRegister {
390
380
  case 'red':
391
381
  case 'satori':
392
382
  case 'chronocat': {
383
+ // 获取该会话机器人
384
+ const bot = this.getBot(ctx, session.event.platform);
393
385
  // 检查机器人是否加入该群
394
- okGuild = await checkIfGuildHasJoined(this.bot);
386
+ okGuild = await checkIfGuildHasJoined(bot);
395
387
  break;
396
388
  }
397
389
  default: {
@@ -509,7 +501,7 @@ class ComRegister {
509
501
  if (index === -1)
510
502
  return '请勿直接调用该指令';
511
503
  // 开始循环检测
512
- const dispose = ctx.setInterval(this.liveDetect(ctx, roomId, guildId), config.liveLoopTime * 1000);
504
+ const dispose = ctx.setInterval(this.liveDetect(ctx, roomId, guildId, this.subManager[index].platform), config.liveLoopTime * 1000);
513
505
  // 保存销毁函数
514
506
  this.subManager[index].liveDispose = dispose;
515
507
  });
@@ -580,15 +572,18 @@ class ComRegister {
580
572
  await session.send('已发送消息,如未收到则说明您的机器人不支持发送私聊消息或您的信息填写有误');
581
573
  });
582
574
  }
575
+ getBot(ctx, pf) {
576
+ return ctx.bots.find(bot => bot.platform === pf);
577
+ }
583
578
  async sendPrivateMsg(content) {
584
579
  if (this.config.master.enable) {
585
580
  if (this.config.master.masterAccountGuildId) {
586
581
  // 向机器人主人发送消息
587
- await this.bot.sendPrivateMessage(this.config.master.masterAccount, content, this.config.master.masterAccountGuildId);
582
+ await this.privateBot.sendPrivateMessage(this.config.master.masterAccount, content, this.config.master.masterAccountGuildId);
588
583
  }
589
584
  else {
590
585
  // 向机器人主人发送消息
591
- await this.bot.sendPrivateMessage(this.config.master.masterAccount, content);
586
+ await this.privateBot.sendPrivateMessage(this.config.master.masterAccount, content);
592
587
  }
593
588
  }
594
589
  }
@@ -633,13 +628,15 @@ class ComRegister {
633
628
  // 结束
634
629
  return;
635
630
  }
636
- async sendMsg(targets, content) {
631
+ async sendMsg(ctx, targets, content, platform) {
632
+ // 获取机器人实例
633
+ const bot = this.getBot(ctx, platform);
637
634
  // 定义需要发送的数组
638
635
  let sendArr = [];
639
636
  // 判断是否需要推送所有机器人加入的群
640
637
  if (targets[0] === 'all') {
641
638
  // 获取所有guild
642
- for (const guild of (await this.bot.getGuildList()).data) {
639
+ for (const guild of (await bot.getGuildList()).data) {
643
640
  sendArr.push(guild.id);
644
641
  }
645
642
  }
@@ -648,7 +645,7 @@ class ComRegister {
648
645
  }
649
646
  // 循环给每个群组发送
650
647
  for (const guild of sendArr) {
651
- await this.sendMsgFunc(guild, content);
648
+ await this.sendMsgFunc(bot, guild, content);
652
649
  }
653
650
  }
654
651
  dynamicDetect(ctx) {
@@ -778,13 +775,13 @@ class ComRegister {
778
775
  if (e.message === '出现关键词,屏蔽该动态') {
779
776
  // 如果需要发送才发送
780
777
  if (this.config.filter.notify) {
781
- await this.sendMsg(sub.targetIdArr, `${upName}发布了一条含有屏蔽关键字的动态`);
778
+ await this.sendMsg(ctx, sub.targetIdArr, `${upName}发布了一条含有屏蔽关键字的动态`, sub.platform);
782
779
  }
783
780
  return;
784
781
  }
785
782
  if (e.message === '已屏蔽转发动态') {
786
783
  if (this.config.filter.notify) {
787
- await this.sendMsg(sub.targetIdArr, `${upName}发布了一条转发动态,已屏蔽`);
784
+ await this.sendMsg(ctx, sub.targetIdArr, `${upName}发布了一条转发动态,已屏蔽`, sub.platform);
788
785
  }
789
786
  return;
790
787
  }
@@ -802,12 +799,12 @@ class ComRegister {
802
799
  if (pic) {
803
800
  this.logger.info('推送动态中,使用render模式');
804
801
  // pic存在,使用的是render模式
805
- await this.sendMsg(sub.targetIdArr, pic + (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: dUrl }));
802
+ await this.sendMsg(ctx, sub.targetIdArr, pic + (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: dUrl }), sub.platform);
806
803
  }
807
804
  else if (buffer) {
808
805
  this.logger.info('推送动态中,使用page模式');
809
806
  // pic不存在,说明使用的是page模式
810
- await this.sendMsg(sub.targetIdArr, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), dUrl] }));
807
+ await this.sendMsg(ctx, sub.targetIdArr, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), dUrl] }), sub.platform);
811
808
  }
812
809
  else {
813
810
  this.logger.info(items[num].modules.module_author.name + '发布了一条动态,但是推送失败');
@@ -962,13 +959,13 @@ class ComRegister {
962
959
  if (e.message === '出现关键词,屏蔽该动态') {
963
960
  // 如果需要发送才发送
964
961
  if (this.config.filter.notify) {
965
- await this.sendMsg(sub.targetIdArr, `${upName}发布了一条含有屏蔽关键字的动态`);
962
+ await this.sendMsg(ctx, sub.targetIdArr, `${upName}发布了一条含有屏蔽关键字的动态`, sub.platform);
966
963
  }
967
964
  return;
968
965
  }
969
966
  if (e.message === '已屏蔽转发动态') {
970
967
  if (this.config.filter.notify) {
971
- await this.sendMsg(sub.targetIdArr, `${upName}发布了一条转发动态,已屏蔽`);
968
+ await this.sendMsg(ctx, sub.targetIdArr, `${upName}发布了一条转发动态,已屏蔽`, sub.platform);
972
969
  }
973
970
  return;
974
971
  }
@@ -986,12 +983,12 @@ class ComRegister {
986
983
  if (pic) {
987
984
  this.logger.info('推送动态中,使用render模式');
988
985
  // pic存在,使用的是render模式
989
- await this.sendMsg(sub.targetIdArr, pic + (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: dUrl }));
986
+ await this.sendMsg(ctx, sub.targetIdArr, pic + (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: dUrl }), sub.platform);
990
987
  }
991
988
  else if (buffer) {
992
989
  this.logger.info('推送动态中,使用page模式');
993
990
  // pic不存在,说明使用的是page模式
994
- await this.sendMsg(sub.targetIdArr, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), dUrl] }));
991
+ await this.sendMsg(ctx, sub.targetIdArr, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), dUrl] }), sub.platform);
995
992
  }
996
993
  else {
997
994
  this.logger.info(items[num].modules.module_author.name + '发布了一条动态,但是推送失败');
@@ -1005,7 +1002,7 @@ class ComRegister {
1005
1002
  }
1006
1003
  };
1007
1004
  }
1008
- liveDetect(ctx, roomId, guildId) {
1005
+ liveDetect(ctx, roomId, guildId, platform) {
1009
1006
  let firstSubscription = true;
1010
1007
  let timer = 0;
1011
1008
  let open = false;
@@ -1015,80 +1012,40 @@ class ComRegister {
1015
1012
  // 相当于锁的作用,防止上一个循环没处理完
1016
1013
  let flag = true;
1017
1014
  // 定义发送直播通知卡片方法
1018
- let sendLiveNotifyCard;
1019
- // 判断直播是否需要@全体成员
1020
- if (this.config.pushUrl) {
1021
- sendLiveNotifyCard = async (data, liveType, liveStartMsg, atAll) => {
1022
- // 定义变量
1023
- let pic;
1024
- let buffer;
1025
- // 多次尝试生成图片
1026
- const attempts = 3;
1027
- for (let i = 0; i < attempts; i++) {
1028
- try {
1029
- // 获取直播通知卡片
1030
- const { pic: picv, buffer: bufferv } = await ctx.gi.generateLiveImg(data, username, userface, liveType);
1031
- // 赋值
1032
- pic = picv;
1033
- buffer = bufferv;
1034
- // 成功则跳出循环
1035
- break;
1036
- }
1037
- catch (e) {
1038
- if (i === attempts - 1) { // 已尝试三次
1039
- this.logger.error('liveDetect generateLiveImg() 推送卡片生成失败,原因:' + e.message);
1040
- // 发送私聊消息并重启服务
1041
- return await this.sendPrivateMsgAndStopService(ctx);
1042
- }
1043
- }
1044
- }
1045
- // 推送直播信息
1046
- // pic 存在,使用的是render模式
1047
- if (pic) {
1048
- const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg, liveType !== LiveType.StartBroadcasting ? `https://live.bilibili.com/${roomId}` : ''] });
1049
- return await this.sendMsg(guildId, pic + msg);
1015
+ const sendLiveNotifyCard = async (data, liveType, liveStartMsg, atAll) => {
1016
+ // 定义变量
1017
+ let pic;
1018
+ let buffer;
1019
+ // 多次尝试生成图片
1020
+ const attempts = 3;
1021
+ for (let i = 0; i < attempts; i++) {
1022
+ try {
1023
+ // 获取直播通知卡片
1024
+ const { pic: picv, buffer: bufferv } = await ctx.gi.generateLiveImg(data, username, userface, liveType);
1025
+ // 赋值
1026
+ pic = picv;
1027
+ buffer = bufferv;
1028
+ // 成功则跳出循环
1029
+ break;
1050
1030
  }
1051
- // pic不存在,说明使用的是page模式
1052
- const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg, liveType !== LiveType.StartBroadcasting ? `https://live.bilibili.com/${roomId}` : ''] });
1053
- await this.sendMsg(guildId, msg);
1054
- };
1055
- }
1056
- else {
1057
- sendLiveNotifyCard = async (data, liveType, liveStartMsg, atAll) => {
1058
- // 定义变量
1059
- let pic;
1060
- let buffer;
1061
- // 多次尝试生成图片
1062
- const attempts = 3;
1063
- for (let i = 0; i < attempts; i++) {
1064
- try {
1065
- // 获取直播通知卡片
1066
- const { pic: picv, buffer: bufferv } = await ctx.gi.generateLiveImg(data, username, userface, liveType);
1067
- // 赋值
1068
- pic = picv;
1069
- buffer = bufferv;
1070
- // 成功则跳出循环
1071
- break;
1072
- }
1073
- catch (e) {
1074
- if (i === attempts - 1) { // 已尝试三次
1075
- this.logger.error('liveDetect generateLiveImg() 推送卡片生成失败,原因:' + e.message);
1076
- // 发送私聊消息并重启服务
1077
- return await this.sendPrivateMsgAndStopService(ctx);
1078
- }
1031
+ catch (e) {
1032
+ if (i === attempts - 1) { // 已尝试三次
1033
+ this.logger.error('liveDetect generateLiveImg() 推送卡片生成失败,原因:' + e.message);
1034
+ // 发送私聊消息并重启服务
1035
+ return await this.sendPrivateMsgAndStopService(ctx);
1079
1036
  }
1080
1037
  }
1081
- // 推送直播信息
1082
- // pic 存在,使用的是render模式
1083
- if (pic) {
1084
- const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg] });
1085
- return await this.sendMsg(guildId, pic + msg);
1086
- }
1087
- // pic不存在,说明使用的是page模式
1088
- const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg] });
1089
- await this.sendMsg(guildId, msg);
1090
- };
1091
- }
1038
+ }
1039
+ // 推送直播信息
1040
+ // pic 存在,使用的是render模式
1041
+ if (pic) {
1042
+ const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg] });
1043
+ return await this.sendMsg(ctx, guildId, pic + msg, platform);
1044
+ }
1045
+ // pic不存在,说明使用的是page模式
1046
+ const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg] });
1047
+ await this.sendMsg(ctx, guildId, msg, platform);
1048
+ };
1092
1049
  // 定义获取主播信息方法
1093
1050
  let useMasterInfo;
1094
1051
  if (this.config.changeMasterInfoApi) {
@@ -1230,8 +1187,13 @@ class ComRegister {
1230
1187
  if (timer >= (6 * 60 * this.config.pushTime)) { // 到时间推送直播消息
1231
1188
  // 到时间重新计时
1232
1189
  timer = 0;
1190
+ // 定义直播中通知消息
1191
+ const liveMsg = this.config.customLive
1192
+ .replace('-name', username)
1193
+ .replace('-time', await ctx.gi.getTimeDifference(liveTime))
1194
+ .replace('-link', `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`);
1233
1195
  // 发送直播通知卡片
1234
- sendLiveNotifyCard(data, LiveType.LiveBroadcast);
1196
+ sendLiveNotifyCard(data, LiveType.LiveBroadcast, liveMsg);
1235
1197
  }
1236
1198
  }
1237
1199
  // 否则继续循环
@@ -1533,7 +1495,7 @@ class ComRegister {
1533
1495
  // 直播订阅数+1
1534
1496
  liveSubNum++;
1535
1497
  // 订阅直播,开始循环检测
1536
- const dispose = ctx.setInterval(this.liveDetect(ctx, sub.room_id, targetIdArr), this.config.liveLoopTime * 1000);
1498
+ const dispose = ctx.setInterval(this.liveDetect(ctx, sub.room_id, targetIdArr, sub.platform), this.config.liveLoopTime * 1000);
1537
1499
  // 保存销毁函数
1538
1500
  subManagerItem.liveDispose = dispose;
1539
1501
  }
@@ -1672,9 +1634,9 @@ class ComRegister {
1672
1634
  }
1673
1635
  (function (ComRegister) {
1674
1636
  ComRegister.Config = koishi_1.Schema.object({
1675
- platform: koishi_1.Schema.string(),
1676
1637
  master: koishi_1.Schema.object({
1677
1638
  enable: koishi_1.Schema.boolean(),
1639
+ platform: koishi_1.Schema.string(),
1678
1640
  masterAccount: koishi_1.Schema.string(),
1679
1641
  masterAccountGuildId: koishi_1.Schema.string()
1680
1642
  }),
@@ -1683,10 +1645,10 @@ class ComRegister {
1683
1645
  changeMasterInfoApi: koishi_1.Schema.boolean().required(),
1684
1646
  liveStartAtAll: koishi_1.Schema.boolean().required(),
1685
1647
  restartPush: koishi_1.Schema.boolean().required(),
1686
- pushUrl: koishi_1.Schema.boolean().required(),
1687
1648
  pushTime: koishi_1.Schema.number().required(),
1688
1649
  liveLoopTime: koishi_1.Schema.number().default(10),
1689
1650
  customLiveStart: koishi_1.Schema.string().required(),
1651
+ customLive: koishi_1.Schema.string(),
1690
1652
  customLiveEnd: koishi_1.Schema.string().required(),
1691
1653
  dynamicUrl: koishi_1.Schema.boolean().required(),
1692
1654
  dynamicLoopTime: koishi_1.Schema.number().default(60),
package/lib/index.d.ts CHANGED
@@ -9,7 +9,6 @@ declare module 'koishi' {
9
9
  export interface Config {
10
10
  require: {};
11
11
  key: string;
12
- platform: 'qq' | 'qqguild' | 'onebot' | 'discord' | 'red' | 'telegram' | 'satori' | 'chronocat' | 'lark';
13
12
  master: {};
14
13
  basicSettings: {};
15
14
  unlockSubLimits: boolean;
@@ -24,9 +23,9 @@ export interface Config {
24
23
  changeMasterInfoApi: boolean;
25
24
  liveStartAtAll: boolean;
26
25
  restartPush: boolean;
27
- pushUrl: boolean;
28
26
  pushTime: number;
29
27
  customLiveStart: string;
28
+ customLive: string;
30
29
  customLiveEnd: string;
31
30
  hideDesc: boolean;
32
31
  style: {};
package/lib/index.js CHANGED
@@ -57,10 +57,6 @@ exports.Config = koishi_1.Schema.object({
57
57
  .role('secret')
58
58
  .required()
59
59
  .description('请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/'),
60
- platform: koishi_1.Schema.union(['qq', 'qqguild', 'onebot', 'discord', 'red', 'telegram', 'satori', 'chronocat', 'lark'])
61
- .role('')
62
- .required()
63
- .description('请选择你的机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件'),
64
60
  master: koishi_1.Schema.intersect([
65
61
  koishi_1.Schema.object({
66
62
  enable: koishi_1.Schema.boolean()
@@ -70,6 +66,8 @@ exports.Config = koishi_1.Schema.object({
70
66
  koishi_1.Schema.union([
71
67
  koishi_1.Schema.object({
72
68
  enable: koishi_1.Schema.const(true).required(),
69
+ platform: koishi_1.Schema.union(['qq', 'qqguild', 'onebot', 'discord', 'red', 'telegram', 'satori', 'chronocat', 'lark'])
70
+ .description('请选择您的私人机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件'),
73
71
  masterAccount: koishi_1.Schema.string()
74
72
  .role('secret')
75
73
  .required()
@@ -120,9 +118,6 @@ exports.Config = koishi_1.Schema.object({
120
118
  restartPush: koishi_1.Schema.boolean()
121
119
  .default(true)
122
120
  .description('插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启'),
123
- pushUrl: koishi_1.Schema.boolean()
124
- .default(false)
125
- .description('推送直播状态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!'),
126
121
  pushTime: koishi_1.Schema.number()
127
122
  .min(0)
128
123
  .max(12)
@@ -132,6 +127,8 @@ exports.Config = koishi_1.Schema.object({
132
127
  customLiveStart: koishi_1.Schema.string()
133
128
  .default('-name开播啦 -link')
134
129
  .description('自定义开播提示语,-name代表UP昵称,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦'),
130
+ customLive: koishi_1.Schema.string()
131
+ .description('自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx'),
135
132
  customLiveEnd: koishi_1.Schema.string()
136
133
  .default('-name下播啦,本次直播了-time')
137
134
  .description('自定义下播提示语,-name代表UP昵称,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒'),
@@ -293,14 +290,12 @@ class ServerManager extends koishi_1.Service {
293
290
  });
294
291
  // CR = ComRegister
295
292
  const cr = this.ctx.plugin(comRegister_1.default, {
296
- platform: globalConfig.platform,
297
293
  master: globalConfig.master,
298
294
  unlockSubLimits: globalConfig.unlockSubLimits,
299
295
  automaticResend: globalConfig.automaticResend,
300
296
  changeMasterInfoApi: globalConfig.changeMasterInfoApi,
301
297
  liveStartAtAll: globalConfig.liveStartAtAll,
302
298
  restartPush: globalConfig.restartPush,
303
- pushUrl: globalConfig.pushUrl,
304
299
  pushTime: globalConfig.pushTime,
305
300
  customLiveStart: globalConfig.customLiveStart,
306
301
  customLiveEnd: globalConfig.customLiveEnd,
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.3",
4
+ "version": "2.0.0-alpha.5",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],