koishi-plugin-bilibili-notify 2.0.0-alpha.4 → 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.
package/README.md CHANGED
@@ -182,6 +182,7 @@
182
182
  - ver 2.0.0-alpha.2 新增:支持Discord平台。优化了下播通知
183
183
  - ver 2.0.0-alpha.3 修复:订阅和取消订阅的bug,下播通知的bug
184
184
  - ver 2.0.0-alpha.4 修复:初次订阅后不推送动态的bug 优化:下播不再发送链接
185
+ - ver 2.0.0-alpha.5 移除:选项pushUrl,选项platform 新增:选项customLive,主人账号中platform选项。支持多平台,且可同时推送不同平台,单个UP主只能推送一个平台
185
186
 
186
187
  ## 交流群
187
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);
@@ -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
  // 未登录直接返回
@@ -394,8 +380,10 @@ class ComRegister {
394
380
  case 'red':
395
381
  case 'satori':
396
382
  case 'chronocat': {
383
+ // 获取该会话机器人
384
+ const bot = this.getBot(ctx, session.event.platform);
397
385
  // 检查机器人是否加入该群
398
- okGuild = await checkIfGuildHasJoined(this.bot);
386
+ okGuild = await checkIfGuildHasJoined(bot);
399
387
  break;
400
388
  }
401
389
  default: {
@@ -513,7 +501,7 @@ class ComRegister {
513
501
  if (index === -1)
514
502
  return '请勿直接调用该指令';
515
503
  // 开始循环检测
516
- 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);
517
505
  // 保存销毁函数
518
506
  this.subManager[index].liveDispose = dispose;
519
507
  });
@@ -584,15 +572,18 @@ class ComRegister {
584
572
  await session.send('已发送消息,如未收到则说明您的机器人不支持发送私聊消息或您的信息填写有误');
585
573
  });
586
574
  }
575
+ getBot(ctx, pf) {
576
+ return ctx.bots.find(bot => bot.platform === pf);
577
+ }
587
578
  async sendPrivateMsg(content) {
588
579
  if (this.config.master.enable) {
589
580
  if (this.config.master.masterAccountGuildId) {
590
581
  // 向机器人主人发送消息
591
- 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);
592
583
  }
593
584
  else {
594
585
  // 向机器人主人发送消息
595
- await this.bot.sendPrivateMessage(this.config.master.masterAccount, content);
586
+ await this.privateBot.sendPrivateMessage(this.config.master.masterAccount, content);
596
587
  }
597
588
  }
598
589
  }
@@ -637,13 +628,15 @@ class ComRegister {
637
628
  // 结束
638
629
  return;
639
630
  }
640
- async sendMsg(targets, content) {
631
+ async sendMsg(ctx, targets, content, platform) {
632
+ // 获取机器人实例
633
+ const bot = this.getBot(ctx, platform);
641
634
  // 定义需要发送的数组
642
635
  let sendArr = [];
643
636
  // 判断是否需要推送所有机器人加入的群
644
637
  if (targets[0] === 'all') {
645
638
  // 获取所有guild
646
- for (const guild of (await this.bot.getGuildList()).data) {
639
+ for (const guild of (await bot.getGuildList()).data) {
647
640
  sendArr.push(guild.id);
648
641
  }
649
642
  }
@@ -652,7 +645,7 @@ class ComRegister {
652
645
  }
653
646
  // 循环给每个群组发送
654
647
  for (const guild of sendArr) {
655
- await this.sendMsgFunc(guild, content);
648
+ await this.sendMsgFunc(bot, guild, content);
656
649
  }
657
650
  }
658
651
  dynamicDetect(ctx) {
@@ -782,13 +775,13 @@ class ComRegister {
782
775
  if (e.message === '出现关键词,屏蔽该动态') {
783
776
  // 如果需要发送才发送
784
777
  if (this.config.filter.notify) {
785
- await this.sendMsg(sub.targetIdArr, `${upName}发布了一条含有屏蔽关键字的动态`);
778
+ await this.sendMsg(ctx, sub.targetIdArr, `${upName}发布了一条含有屏蔽关键字的动态`, sub.platform);
786
779
  }
787
780
  return;
788
781
  }
789
782
  if (e.message === '已屏蔽转发动态') {
790
783
  if (this.config.filter.notify) {
791
- await this.sendMsg(sub.targetIdArr, `${upName}发布了一条转发动态,已屏蔽`);
784
+ await this.sendMsg(ctx, sub.targetIdArr, `${upName}发布了一条转发动态,已屏蔽`, sub.platform);
792
785
  }
793
786
  return;
794
787
  }
@@ -806,12 +799,12 @@ class ComRegister {
806
799
  if (pic) {
807
800
  this.logger.info('推送动态中,使用render模式');
808
801
  // pic存在,使用的是render模式
809
- 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);
810
803
  }
811
804
  else if (buffer) {
812
805
  this.logger.info('推送动态中,使用page模式');
813
806
  // pic不存在,说明使用的是page模式
814
- 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);
815
808
  }
816
809
  else {
817
810
  this.logger.info(items[num].modules.module_author.name + '发布了一条动态,但是推送失败');
@@ -966,13 +959,13 @@ class ComRegister {
966
959
  if (e.message === '出现关键词,屏蔽该动态') {
967
960
  // 如果需要发送才发送
968
961
  if (this.config.filter.notify) {
969
- await this.sendMsg(sub.targetIdArr, `${upName}发布了一条含有屏蔽关键字的动态`);
962
+ await this.sendMsg(ctx, sub.targetIdArr, `${upName}发布了一条含有屏蔽关键字的动态`, sub.platform);
970
963
  }
971
964
  return;
972
965
  }
973
966
  if (e.message === '已屏蔽转发动态') {
974
967
  if (this.config.filter.notify) {
975
- await this.sendMsg(sub.targetIdArr, `${upName}发布了一条转发动态,已屏蔽`);
968
+ await this.sendMsg(ctx, sub.targetIdArr, `${upName}发布了一条转发动态,已屏蔽`, sub.platform);
976
969
  }
977
970
  return;
978
971
  }
@@ -990,12 +983,12 @@ class ComRegister {
990
983
  if (pic) {
991
984
  this.logger.info('推送动态中,使用render模式');
992
985
  // pic存在,使用的是render模式
993
- 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);
994
987
  }
995
988
  else if (buffer) {
996
989
  this.logger.info('推送动态中,使用page模式');
997
990
  // pic不存在,说明使用的是page模式
998
- 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);
999
992
  }
1000
993
  else {
1001
994
  this.logger.info(items[num].modules.module_author.name + '发布了一条动态,但是推送失败');
@@ -1009,7 +1002,7 @@ class ComRegister {
1009
1002
  }
1010
1003
  };
1011
1004
  }
1012
- liveDetect(ctx, roomId, guildId) {
1005
+ liveDetect(ctx, roomId, guildId, platform) {
1013
1006
  let firstSubscription = true;
1014
1007
  let timer = 0;
1015
1008
  let open = false;
@@ -1019,80 +1012,40 @@ class ComRegister {
1019
1012
  // 相当于锁的作用,防止上一个循环没处理完
1020
1013
  let flag = true;
1021
1014
  // 定义发送直播通知卡片方法
1022
- let sendLiveNotifyCard;
1023
- // 判断直播是否需要@全体成员
1024
- if (this.config.pushUrl) {
1025
- sendLiveNotifyCard = async (data, liveType, liveStartMsg, atAll) => {
1026
- // 定义变量
1027
- let pic;
1028
- let buffer;
1029
- // 多次尝试生成图片
1030
- const attempts = 3;
1031
- for (let i = 0; i < attempts; i++) {
1032
- try {
1033
- // 获取直播通知卡片
1034
- const { pic: picv, buffer: bufferv } = await ctx.gi.generateLiveImg(data, username, userface, liveType);
1035
- // 赋值
1036
- pic = picv;
1037
- buffer = bufferv;
1038
- // 成功则跳出循环
1039
- break;
1040
- }
1041
- catch (e) {
1042
- if (i === attempts - 1) { // 已尝试三次
1043
- this.logger.error('liveDetect generateLiveImg() 推送卡片生成失败,原因:' + e.message);
1044
- // 发送私聊消息并重启服务
1045
- return await this.sendPrivateMsgAndStopService(ctx);
1046
- }
1047
- }
1048
- }
1049
- // 推送直播信息
1050
- // pic 存在,使用的是render模式
1051
- if (pic) {
1052
- 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 && liveType !== LiveType.StopBroadcast ? `https://live.bilibili.com/${roomId}` : ''] });
1053
- 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;
1054
1030
  }
1055
- // pic不存在,说明使用的是page模式
1056
- 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}` : ''] });
1057
- await this.sendMsg(guildId, msg);
1058
- };
1059
- }
1060
- else {
1061
- sendLiveNotifyCard = async (data, liveType, liveStartMsg, atAll) => {
1062
- // 定义变量
1063
- let pic;
1064
- let buffer;
1065
- // 多次尝试生成图片
1066
- const attempts = 3;
1067
- for (let i = 0; i < attempts; i++) {
1068
- try {
1069
- // 获取直播通知卡片
1070
- const { pic: picv, buffer: bufferv } = await ctx.gi.generateLiveImg(data, username, userface, liveType);
1071
- // 赋值
1072
- pic = picv;
1073
- buffer = bufferv;
1074
- // 成功则跳出循环
1075
- break;
1076
- }
1077
- catch (e) {
1078
- if (i === attempts - 1) { // 已尝试三次
1079
- this.logger.error('liveDetect generateLiveImg() 推送卡片生成失败,原因:' + e.message);
1080
- // 发送私聊消息并重启服务
1081
- return await this.sendPrivateMsgAndStopService(ctx);
1082
- }
1031
+ catch (e) {
1032
+ if (i === attempts - 1) { // 已尝试三次
1033
+ this.logger.error('liveDetect generateLiveImg() 推送卡片生成失败,原因:' + e.message);
1034
+ // 发送私聊消息并重启服务
1035
+ return await this.sendPrivateMsgAndStopService(ctx);
1083
1036
  }
1084
1037
  }
1085
- // 推送直播信息
1086
- // pic 存在,使用的是render模式
1087
- if (pic) {
1088
- const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg] });
1089
- return await this.sendMsg(guildId, pic + msg);
1090
- }
1091
- // pic不存在,说明使用的是page模式
1092
- 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] });
1093
- await this.sendMsg(guildId, msg);
1094
- };
1095
- }
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
+ };
1096
1049
  // 定义获取主播信息方法
1097
1050
  let useMasterInfo;
1098
1051
  if (this.config.changeMasterInfoApi) {
@@ -1234,8 +1187,13 @@ class ComRegister {
1234
1187
  if (timer >= (6 * 60 * this.config.pushTime)) { // 到时间推送直播消息
1235
1188
  // 到时间重新计时
1236
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}`);
1237
1195
  // 发送直播通知卡片
1238
- sendLiveNotifyCard(data, LiveType.LiveBroadcast);
1196
+ sendLiveNotifyCard(data, LiveType.LiveBroadcast, liveMsg);
1239
1197
  }
1240
1198
  }
1241
1199
  // 否则继续循环
@@ -1537,7 +1495,7 @@ class ComRegister {
1537
1495
  // 直播订阅数+1
1538
1496
  liveSubNum++;
1539
1497
  // 订阅直播,开始循环检测
1540
- 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);
1541
1499
  // 保存销毁函数
1542
1500
  subManagerItem.liveDispose = dispose;
1543
1501
  }
@@ -1676,9 +1634,9 @@ class ComRegister {
1676
1634
  }
1677
1635
  (function (ComRegister) {
1678
1636
  ComRegister.Config = koishi_1.Schema.object({
1679
- platform: koishi_1.Schema.string(),
1680
1637
  master: koishi_1.Schema.object({
1681
1638
  enable: koishi_1.Schema.boolean(),
1639
+ platform: koishi_1.Schema.string(),
1682
1640
  masterAccount: koishi_1.Schema.string(),
1683
1641
  masterAccountGuildId: koishi_1.Schema.string()
1684
1642
  }),
@@ -1687,10 +1645,10 @@ class ComRegister {
1687
1645
  changeMasterInfoApi: koishi_1.Schema.boolean().required(),
1688
1646
  liveStartAtAll: koishi_1.Schema.boolean().required(),
1689
1647
  restartPush: koishi_1.Schema.boolean().required(),
1690
- pushUrl: koishi_1.Schema.boolean().required(),
1691
1648
  pushTime: koishi_1.Schema.number().required(),
1692
1649
  liveLoopTime: koishi_1.Schema.number().default(10),
1693
1650
  customLiveStart: koishi_1.Schema.string().required(),
1651
+ customLive: koishi_1.Schema.string(),
1694
1652
  customLiveEnd: koishi_1.Schema.string().required(),
1695
1653
  dynamicUrl: koishi_1.Schema.boolean().required(),
1696
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.4",
4
+ "version": "2.0.0-alpha.5",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],