koishi-plugin-bilibili-notify 3.0.0-alpha.16 → 3.0.0-alpha.17

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.
@@ -1,34 +1,7 @@
1
1
  import { type Bot, type Context, type FlatPick, type Logger, Schema } from "koishi";
2
2
  import type { Notifier } from "@koishijs/plugin-notifier";
3
3
  import type { LoginBili } from "./database";
4
- declare enum LiveType {
5
- NotLiveBroadcast = 0,
6
- StartBroadcasting = 1,
7
- LiveBroadcast = 2,
8
- StopBroadcast = 3
9
- }
10
- type ChannelIdArr = Array<{
11
- channelId: string;
12
- dynamic: boolean;
13
- live: boolean;
14
- liveGuardBuy: boolean;
15
- atAll: boolean;
16
- }>;
17
- type TargetItem = {
18
- channelIdArr: ChannelIdArr;
19
- platform: string;
20
- };
21
- type Target = Array<TargetItem>;
22
- type SubItem = {
23
- id: number;
24
- uid: string;
25
- roomId: string;
26
- target: Target;
27
- platform: string;
28
- live: boolean;
29
- dynamic: boolean;
30
- };
31
- type SubManager = Array<SubItem>;
4
+ import { LiveType, type MasterInfo, type SubManager, type Target } from "./type";
32
5
  declare class ComRegister {
33
6
  static inject: string[];
34
7
  qqRelatedBotList: Array<string>;
@@ -59,14 +32,9 @@ declare class ComRegister {
59
32
  userface: string;
60
33
  target: Target;
61
34
  data: any;
62
- }, liveType: LiveType, liveNotifyMsg?: string): Promise<void>;
63
- useMasterInfo(uid: string): Promise<{
64
- username: string;
65
- userface: string;
66
- roomId: number;
67
- }>;
35
+ }, liveType: LiveType, followerDisplay: string, liveNotifyMsg?: string): Promise<void>;
36
+ useMasterInfo(uid: string, masterInfo: MasterInfo, liveType: LiveType): Promise<MasterInfo>;
68
37
  useLiveRoomInfo(roomId: string): Promise<any>;
69
- liveDetectWithAPI(): Promise<() => Promise<void>>;
70
38
  liveDetectWithListener(roomId: string, target: Target): Promise<void>;
71
39
  subShow(): string;
72
40
  updateSubNotifier(): void;
@@ -7,16 +7,10 @@ const jsx_runtime_1 = require("@satorijs/element/jsx-runtime");
7
7
  const koishi_1 = require("koishi");
8
8
  // 导入qrcode
9
9
  const qrcode_1 = __importDefault(require("qrcode"));
10
+ const type_1 = require("./type");
10
11
  // 弹幕词云
11
12
  // TODO:WorlCloud
12
13
  // import { Segment } from "segmentit";
13
- var LiveType;
14
- (function (LiveType) {
15
- LiveType[LiveType["NotLiveBroadcast"] = 0] = "NotLiveBroadcast";
16
- LiveType[LiveType["StartBroadcasting"] = 1] = "StartBroadcasting";
17
- LiveType[LiveType["LiveBroadcast"] = 2] = "LiveBroadcast";
18
- LiveType[LiveType["StopBroadcast"] = 3] = "StopBroadcast";
19
- })(LiveType || (LiveType = {}));
20
14
  class ComRegister {
21
15
  // 必须服务
22
16
  static inject = ["ba", "gi", "database", "bl", "sm"];
@@ -206,53 +200,6 @@ class ComRegister {
206
200
  const subTable = this.subShow();
207
201
  return subTable;
208
202
  });
209
- biliCom
210
- .subcommand(".status <roomId:string>", "查询主播当前直播状态", {
211
- hidden: true,
212
- })
213
- .usage("查询主播当前直播状态")
214
- .example("bili status 732")
215
- .action(async ({ session }, roomId) => {
216
- this.logger.info("调用bili.status指令");
217
- if (!roomId)
218
- return session.send("请输入房间号!");
219
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
220
- let content;
221
- try {
222
- content = await ctx.ba.getLiveRoomInfo(roomId);
223
- }
224
- catch (e) {
225
- return `bili status指令 getLiveRoomInfo() 发生了错误,错误为:${e.message}`;
226
- }
227
- const { data } = content;
228
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
229
- let userData;
230
- try {
231
- const { data: userInfo } = await ctx.ba.getMasterInfo(data.uid);
232
- userData = userInfo;
233
- }
234
- catch (e) {
235
- return `bili status指令 getMasterInfo() 发生了错误,错误为:${e.message}`;
236
- }
237
- // B站出问题了
238
- if (content.code !== 0) {
239
- if (content.msg === "未找到该房间") {
240
- session.send("未找到该房间");
241
- }
242
- else {
243
- session.send(`未知错误,错误信息为:${content.message}`);
244
- }
245
- return;
246
- }
247
- const { pic, buffer } = await ctx.gi.generateLiveImg(data, userData.info.uname, userData.info.face, data.live_status !== 1
248
- ? LiveType.NotLiveBroadcast
249
- : LiveType.LiveBroadcast);
250
- // pic 存在,使用的是render模式
251
- if (pic)
252
- return pic;
253
- // pic不存在,说明使用的是page模式
254
- await session.send(koishi_1.h.image(buffer, "image/png"));
255
- });
256
203
  biliCom
257
204
  .subcommand(".private", "向主人账号发送一条测试消息", { hidden: true })
258
205
  .usage("向主人账号发送一条测试消息")
@@ -860,7 +807,7 @@ class ComRegister {
860
807
  };
861
808
  }
862
809
  // 定义发送直播通知卡片方法
863
- async sendLiveNotifyCard(info, liveType, liveNotifyMsg) {
810
+ async sendLiveNotifyCard(info, liveType, followerDisplay, liveNotifyMsg) {
864
811
  // 定义变量
865
812
  let pic;
866
813
  let buffer;
@@ -869,7 +816,7 @@ class ComRegister {
869
816
  for (let i = 0; i < attempts; i++) {
870
817
  try {
871
818
  // 获取直播通知卡片
872
- const { pic: picv, buffer: bufferv } = await this.ctx.gi.generateLiveImg(info.data, info.username, info.userface, liveType);
819
+ const { pic: picv, buffer: bufferv } = await this.ctx.gi.generateLiveImg(info.data, info.username, info.userface, followerDisplay, liveType);
873
820
  // 赋值
874
821
  pic = picv;
875
822
  buffer = bufferv;
@@ -889,7 +836,7 @@ class ComRegister {
889
836
  // pic 存在,使用的是render模式
890
837
  if (pic) {
891
838
  // 只有在开播时才艾特全体成员
892
- if (liveType === LiveType.StartBroadcasting) {
839
+ if (liveType === type_1.LiveType.StartBroadcasting) {
893
840
  return await this.sendMsg(info.target, pic + (liveNotifyMsg ?? ""), true);
894
841
  }
895
842
  // 正常不需要艾特全体成员
@@ -898,19 +845,47 @@ class ComRegister {
898
845
  // pic不存在,说明使用的是page模式
899
846
  const msg = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, "image/png"), liveNotifyMsg || ""] }));
900
847
  // 只有在开播时才艾特全体成员
901
- if (liveType === LiveType.StartBroadcasting) {
848
+ if (liveType === type_1.LiveType.StartBroadcasting) {
902
849
  return await this.sendMsg(info.target, msg, true);
903
850
  }
904
851
  // 正常不需要艾特全体成员
905
852
  return await this.sendMsg(info.target, msg);
906
853
  }
907
854
  // 定义获取主播信息方法
908
- async useMasterInfo(uid) {
855
+ async useMasterInfo(uid, masterInfo, liveType) {
856
+ // 获取主播信息
909
857
  const { data } = await this.ctx.ba.getMasterInfo(uid);
858
+ // 定义粉丝数变量
859
+ let liveOpenFollowerNum;
860
+ let liveEndFollowerNum;
861
+ let liveFollowerChange;
862
+ // 判断直播状态
863
+ if (liveType === type_1.LiveType.StartBroadcasting ||
864
+ liveType === type_1.LiveType.FirstLiveBroadcast) {
865
+ // 第一次启动或刚开播
866
+ // 将当前粉丝数赋值给liveOpenFollowerNum、liveEndFollowerNum
867
+ liveOpenFollowerNum = data.follower_num;
868
+ liveEndFollowerNum = data.follower_num;
869
+ // 将粉丝数变化赋值为0
870
+ liveFollowerChange = 0;
871
+ }
872
+ if (liveType === type_1.LiveType.StopBroadcast ||
873
+ liveType === type_1.LiveType.LiveBroadcast) {
874
+ // 将上一次的liveOpenFollowerNum赋值给本次的liveOpenFollowerNum
875
+ liveOpenFollowerNum = masterInfo.liveOpenFollowerNum;
876
+ // 将当前粉丝数赋值给liveEndFollowerNum
877
+ liveEndFollowerNum = data.follower_num;
878
+ // 计算粉丝数变化量
879
+ liveFollowerChange = liveEndFollowerNum - masterInfo.liveOpenFollowerNum;
880
+ }
881
+ // 返回值
910
882
  return {
911
883
  username: data.info.uname,
912
884
  userface: data.info.face,
913
885
  roomId: data.room_id,
886
+ liveOpenFollowerNum,
887
+ liveEndFollowerNum,
888
+ liveFollowerChange,
914
889
  };
915
890
  }
916
891
  async useLiveRoomInfo(roomId) {
@@ -936,7 +911,7 @@ class ComRegister {
936
911
  }
937
912
  return content.data;
938
913
  }
939
- async liveDetectWithAPI() {
914
+ /* async liveDetectWithAPI() {
940
915
  // 定义变量:第一次订阅
941
916
  let liveDetectSetup = true;
942
917
  // 定义变量:timer计时器
@@ -944,11 +919,19 @@ class ComRegister {
944
919
  // 相当于锁的作用,防止上一个循环没处理完
945
920
  let flag = true;
946
921
  // 定义订阅对象Record 0未开播 1正在直播 2轮播中
947
- const liveRecord = {};
922
+ const liveRecord: Record<
923
+ number,
924
+ {
925
+ liveStatus: number;
926
+ liveTime: string;
927
+ target: Target;
928
+ }
929
+ > = {};
930
+
948
931
  // 定义函数: 发送请求获取直播状态
949
- const useLiveStatus = async (roomId) => {
932
+ const useLiveStatus = async (roomId: string) => {
950
933
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
951
- let content;
934
+ let content: any;
952
935
  const attempts = 3;
953
936
  for (let i = 0; i < attempts; i++) {
954
937
  try {
@@ -956,9 +939,10 @@ class ComRegister {
956
939
  content = await this.ctx.ba.getLiveRoomInfo(roomId);
957
940
  // 成功则跳出循环
958
941
  break;
959
- }
960
- catch (e) {
961
- this.logger.error(`liveDetect getLiveRoomInfo 发生了错误,错误为:${e.message}`);
942
+ } catch (e) {
943
+ this.logger.error(
944
+ `liveDetect getLiveRoomInfo 发生了错误,错误为:${e.message}`,
945
+ );
962
946
  if (i === attempts - 1) {
963
947
  // 已尝试三次
964
948
  // 发送私聊消息并重启服务
@@ -969,10 +953,10 @@ class ComRegister {
969
953
  // 返回data
970
954
  return content.data;
971
955
  };
956
+
972
957
  return async () => {
973
958
  // 如果flag为false则说明前面的代码还未执行完,则直接返回
974
- if (!flag)
975
- return;
959
+ if (!flag) return;
976
960
  // 将标志位置为false
977
961
  flag = false;
978
962
  try {
@@ -1009,18 +993,30 @@ class ComRegister {
1009
993
  // 设置直播中消息
1010
994
  const liveMsg = this.config.customLive
1011
995
  ? this.config.customLive
1012
- .replace("-name", item.uname)
1013
- .replace("-time", await this.ctx.gi.getTimeDifference(liveRecord[item.mid].liveTime))
1014
- .replace("-link", `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`)
996
+ .replace("-name", item.uname)
997
+ .replace(
998
+ "-time",
999
+ await this.ctx.gi.getTimeDifference(
1000
+ liveRecord[item.mid].liveTime,
1001
+ ),
1002
+ )
1003
+ .replace(
1004
+ "-link",
1005
+ `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`,
1006
+ )
1015
1007
  : null;
1016
1008
  // 发送直播通知卡片
1017
1009
  if (this.config.restartPush)
1018
- this.sendLiveNotifyCard({
1019
- username: item.uname,
1020
- userface: item.face,
1021
- target: liveRecord[item.mid].target,
1022
- data,
1023
- }, LiveType.LiveBroadcast, liveMsg);
1010
+ this.sendLiveNotifyCard(
1011
+ {
1012
+ username: item.uname,
1013
+ userface: item.face,
1014
+ target: liveRecord[item.mid].target,
1015
+ data,
1016
+ },
1017
+ LiveType.LiveBroadcast,
1018
+ liveMsg,
1019
+ );
1024
1020
  }
1025
1021
  }
1026
1022
  }
@@ -1067,9 +1063,13 @@ class ComRegister {
1067
1063
  }
1068
1064
  if (currentLiveRecordKeys.length > currentLiveSubs.length) {
1069
1065
  // 创建Set
1070
- const setCurrentLiveSubs = new Set(currentLiveSubs.map((sub) => sub.uid));
1066
+ const setCurrentLiveSubs = new Set(
1067
+ currentLiveSubs.map((sub) => sub.uid),
1068
+ );
1071
1069
  // 找出 currentLiveRecordKeys中比currentLiveSubs 多的元素
1072
- const extraInCurrentLiveSubs = currentLiveRecordKeys.filter((key) => !setCurrentLiveSubs.has(key));
1070
+ const extraInCurrentLiveSubs = currentLiveRecordKeys.filter(
1071
+ (key) => !setCurrentLiveSubs.has(key),
1072
+ );
1073
1073
  // 遍历 extraInCurrentLiveSubs
1074
1074
  for (const subUID of extraInCurrentLiveSubs) {
1075
1075
  // 删除记录
@@ -1093,17 +1093,29 @@ class ComRegister {
1093
1093
  // 定义开播通知语
1094
1094
  const liveStartMsg = this.config.customLiveStart
1095
1095
  ? this.config.customLiveStart
1096
- .replace("-name", item.uname)
1097
- .replace("-time", await this.ctx.gi.getTimeDifference(liveRecord[item.mid].liveTime))
1098
- .replace("-link", `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`)
1096
+ .replace("-name", item.uname)
1097
+ .replace(
1098
+ "-time",
1099
+ await this.ctx.gi.getTimeDifference(
1100
+ liveRecord[item.mid].liveTime,
1101
+ ),
1102
+ )
1103
+ .replace(
1104
+ "-link",
1105
+ `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`,
1106
+ )
1099
1107
  : null;
1100
1108
  // 发送直播通知卡片
1101
- await this.sendLiveNotifyCard({
1102
- username: item.uname,
1103
- userface: item.face,
1104
- target: liveRecord[item.mid].target,
1105
- data,
1106
- }, LiveType.LiveBroadcast, liveStartMsg);
1109
+ await this.sendLiveNotifyCard(
1110
+ {
1111
+ username: item.uname,
1112
+ userface: item.face,
1113
+ target: liveRecord[item.mid].target,
1114
+ data,
1115
+ },
1116
+ LiveType.LiveBroadcast,
1117
+ liveStartMsg,
1118
+ );
1107
1119
  // 改变开播状态
1108
1120
  liveRecord[item.mid].liveStatus = 1;
1109
1121
  // 结束
@@ -1121,17 +1133,29 @@ class ComRegister {
1121
1133
  // 定义直播中通知消息
1122
1134
  const liveMsg = this.config.customLive
1123
1135
  ? this.config.customLive
1124
- .replace("-name", item.uname)
1125
- .replace("-time", await this.ctx.gi.getTimeDifference(liveRecord[item.mid].liveTime))
1126
- .replace("-link", `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`)
1136
+ .replace("-name", item.uname)
1137
+ .replace(
1138
+ "-time",
1139
+ await this.ctx.gi.getTimeDifference(
1140
+ liveRecord[item.mid].liveTime,
1141
+ ),
1142
+ )
1143
+ .replace(
1144
+ "-link",
1145
+ `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`,
1146
+ )
1127
1147
  : null;
1128
1148
  // 发送直播通知卡片
1129
- this.sendLiveNotifyCard({
1130
- username: item.uname,
1131
- userface: item.face,
1132
- target: liveRecord[item.mid].target,
1133
- data,
1134
- }, LiveType.LiveBroadcast, liveMsg);
1149
+ this.sendLiveNotifyCard(
1150
+ {
1151
+ username: item.uname,
1152
+ userface: item.face,
1153
+ target: liveRecord[item.mid].target,
1154
+ data,
1155
+ },
1156
+ LiveType.LiveBroadcast,
1157
+ liveMsg,
1158
+ );
1135
1159
  }
1136
1160
  }
1137
1161
  }
@@ -1139,38 +1163,71 @@ class ComRegister {
1139
1163
  }
1140
1164
  }
1141
1165
  // 找出liveRecord中liveStatus为1但liveUsers中没有的元素
1142
- const extraInLiveRecord = currentLiveRecordKeys.filter((key) => !liveUsers.items.some((item) => item.mid === Number(key)));
1166
+ const extraInLiveRecord = currentLiveRecordKeys.filter(
1167
+ (key) => !liveUsers.items.some((item) => item.mid === Number(key)),
1168
+ );
1143
1169
  // 遍历 extraInLiveRecord
1144
1170
  for (const subUID of extraInLiveRecord) {
1145
1171
  // 下播的主播
1146
1172
  // 获取主播信息
1147
1173
  const masterInfo = await this.useMasterInfo(subUID);
1148
1174
  // 获取直播间消息
1149
- const liveRoomInfo = await this.useLiveRoomInfo(masterInfo.roomId.toString());
1175
+ const liveRoomInfo = await this.useLiveRoomInfo(
1176
+ masterInfo.roomId.toString(),
1177
+ );
1150
1178
  // 设置开播时间
1151
1179
  liveRoomInfo.live_time = liveRecord[subUID].liveTime;
1152
1180
  // 定义下播播通知语
1153
1181
  const liveEndMsg = this.config.customLiveEnd
1154
1182
  ? this.config.customLiveEnd
1155
- .replace("-name", masterInfo.username)
1156
- .replace("-time", await this.ctx.gi.getTimeDifference(liveRecord[subUID].liveTime))
1157
- .replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`)
1183
+ .replace("-name", masterInfo.username)
1184
+ .replace(
1185
+ "-time",
1186
+ await this.ctx.gi.getTimeDifference(
1187
+ liveRecord[subUID].liveTime,
1188
+ ),
1189
+ )
1190
+ .replace(
1191
+ "-link",
1192
+ `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`,
1193
+ )
1158
1194
  : null;
1159
1195
  // 发送下播通知
1160
- this.sendLiveNotifyCard({
1161
- username: masterInfo.username,
1162
- userface: masterInfo.userface,
1163
- target: liveRecord[subUID].target,
1164
- data: liveRoomInfo,
1165
- }, LiveType.StopBroadcast, liveEndMsg);
1196
+ this.sendLiveNotifyCard(
1197
+ {
1198
+ username: masterInfo.username,
1199
+ userface: masterInfo.userface,
1200
+ target: liveRecord[subUID].target,
1201
+ data: liveRoomInfo,
1202
+ },
1203
+ LiveType.StopBroadcast,
1204
+ liveEndMsg,
1205
+ );
1166
1206
  }
1167
- }
1168
- finally {
1207
+ } finally {
1169
1208
  // 执行完方法体不论如何都把flag设置为true
1170
1209
  flag = true;
1171
1210
  }
1172
1211
  };
1173
- }
1212
+ } */
1213
+ // TODO:WordCloud
1214
+ /* // 定义获取弹幕权重Record函数
1215
+ const getDanmakuWeightRecord = (): Record<string, number> => {
1216
+ // 创建segmentit
1217
+ const segmentit = useDefault(new Segment());
1218
+ // 创建Record
1219
+ const danmakuWeightRecord: Record<string, number> = {};
1220
+ // 循环遍历currentLiveDanmakuArr
1221
+ for (const danmaku of currentLiveDanmakuArr) {
1222
+ // 遍历结果
1223
+ segmentit.doSegment(danmaku).map((word: { w: string; p: number }) => {
1224
+ // 定义权重
1225
+ danmakuWeightRecord[word.w] = (danmakuWeightRecord[word.w] || 0) + 1;
1226
+ });
1227
+ }
1228
+ // 返回Record
1229
+ return danmakuWeightRecord;
1230
+ }; */
1174
1231
  async liveDetectWithListener(roomId, target) {
1175
1232
  // 定义开播时间
1176
1233
  let liveTime;
@@ -1187,6 +1244,7 @@ class ComRegister {
1187
1244
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
1188
1245
  let liveRoomInfo;
1189
1246
  let masterInfo;
1247
+ let watchedNum;
1190
1248
  // 找到频道/群组对应的
1191
1249
  const liveGuardBuyPushTargetArr = target.map((channel) => {
1192
1250
  // 获取符合条件的target
@@ -1202,17 +1260,20 @@ class ComRegister {
1202
1260
  // 定义定时推送函数
1203
1261
  const pushAtTimeFunc = async () => {
1204
1262
  // 判断是否信息是否获取成功
1205
- if (!(await useMasterAndLiveRoomInfo())) {
1263
+ if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.LiveBroadcast))) {
1206
1264
  // 未获取成功,直接返回
1207
1265
  return this.sendPrivateMsg("获取直播间信息失败,推送直播卡片失败!");
1208
1266
  }
1209
1267
  // 设置开播时间
1210
1268
  liveTime = liveRoomInfo.live_time;
1269
+ // 获取watched
1270
+ const watched = watchedNum?.toString() || '暂未获取到';
1211
1271
  // 设置直播中消息
1212
1272
  const liveMsg = this.config.customLive
1213
1273
  ? this.config.customLive
1214
1274
  .replace("-name", masterInfo.username)
1215
1275
  .replace("-time", await this.ctx.gi.getTimeDifference(liveTime))
1276
+ .replace("-watched", watched)
1216
1277
  .replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`)
1217
1278
  : null;
1218
1279
  // 发送直播通知卡片
@@ -1221,28 +1282,10 @@ class ComRegister {
1221
1282
  userface: masterInfo.userface,
1222
1283
  target,
1223
1284
  data: liveRoomInfo,
1224
- }, LiveType.LiveBroadcast, liveMsg);
1285
+ }, type_1.LiveType.LiveBroadcast, watched, liveMsg);
1225
1286
  };
1226
- // TODO:WordCloud
1227
- /* // 定义获取弹幕权重Record函数
1228
- const getDanmakuWeightRecord = (): Record<string, number> => {
1229
- // 创建segmentit
1230
- const segmentit = useDefault(new Segment());
1231
- // 创建Record
1232
- const danmakuWeightRecord: Record<string, number> = {};
1233
- // 循环遍历currentLiveDanmakuArr
1234
- for (const danmaku of currentLiveDanmakuArr) {
1235
- // 遍历结果
1236
- segmentit.doSegment(danmaku).map((word: { w: string; p: number }) => {
1237
- // 定义权重
1238
- danmakuWeightRecord[word.w] = (danmakuWeightRecord[word.w] || 0) + 1;
1239
- });
1240
- }
1241
- // 返回Record
1242
- return danmakuWeightRecord;
1243
- }; */
1244
1287
  // 定义直播间信息获取函数
1245
- const useMasterAndLiveRoomInfo = async () => {
1288
+ const useMasterAndLiveRoomInfo = async (liveType) => {
1246
1289
  // 定义函数是否执行成功flag
1247
1290
  let flag = true;
1248
1291
  // 获取直播间信息
@@ -1260,7 +1303,7 @@ class ComRegister {
1260
1303
  return flag;
1261
1304
  }
1262
1305
  // 获取主播信息(需要满足flag为true,liveRoomInfo.uid有值)
1263
- masterInfo = await this.useMasterInfo(liveRoomInfo.uid).catch(() => {
1306
+ masterInfo = await this.useMasterInfo(liveRoomInfo.uid, masterInfo, liveType).catch(() => {
1264
1307
  // 设置flag为false
1265
1308
  flag = false;
1266
1309
  // 返回空
@@ -1269,11 +1312,6 @@ class ComRegister {
1269
1312
  // 返回信息
1270
1313
  return flag;
1271
1314
  };
1272
- // 判断是否信息是否获取成功
1273
- if (!(await useMasterAndLiveRoomInfo())) {
1274
- // 未获取成功,直接返回
1275
- return this.sendPrivateMsg("获取直播间信息失败,启动直播间弹幕检测失败!");
1276
- }
1277
1315
  // 构建消息处理函数
1278
1316
  const handler = {
1279
1317
  onIncomeDanmu: ({ body }) => {
@@ -1284,6 +1322,10 @@ class ComRegister {
1284
1322
  // 保存消息到数组
1285
1323
  currentLiveDanmakuArr.push(body.content);
1286
1324
  },
1325
+ onWatchedChange: ({ body }) => {
1326
+ // 保存观看人数到变量
1327
+ watchedNum = body.num;
1328
+ },
1287
1329
  onGuardBuy: ({ body }) => {
1288
1330
  // 定义消息
1289
1331
  const content = `${body.user.uname}加入了大航海(${body.gift_name})`;
@@ -1297,7 +1339,7 @@ class ComRegister {
1297
1339
  // 设置开播状态为true
1298
1340
  liveStatus = true;
1299
1341
  // 判断是否信息是否获取成功
1300
- if (!(await useMasterAndLiveRoomInfo())) {
1342
+ if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.StartBroadcasting))) {
1301
1343
  // 设置开播状态为false
1302
1344
  liveStatus = false;
1303
1345
  // 未获取成功,直接返回
@@ -1305,11 +1347,14 @@ class ComRegister {
1305
1347
  }
1306
1348
  // 设置开播时间
1307
1349
  liveTime = liveRoomInfo.live_time;
1350
+ // 获取当前粉丝数
1351
+ const follower = masterInfo.liveOpenFollowerNum.toString();
1308
1352
  // 定义开播通知语
1309
1353
  const liveStartMsg = this.config.customLiveStart
1310
1354
  ? this.config.customLiveStart
1311
1355
  .replace("-name", masterInfo.username)
1312
1356
  .replace("-time", await this.ctx.gi.getTimeDifference(liveTime))
1357
+ .replace("-follower", follower)
1313
1358
  .replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`)
1314
1359
  : null;
1315
1360
  // 推送开播通知
@@ -1318,7 +1363,7 @@ class ComRegister {
1318
1363
  userface: masterInfo.userface,
1319
1364
  target,
1320
1365
  data: liveRoomInfo,
1321
- }, LiveType.StartBroadcasting, liveStartMsg);
1366
+ }, type_1.LiveType.StartBroadcasting, follower, liveStartMsg);
1322
1367
  // 判断定时器是否已开启
1323
1368
  if (!pushAtTimeTimer) {
1324
1369
  // 开始直播,开启定时器
@@ -1329,17 +1374,20 @@ class ComRegister {
1329
1374
  // 将直播状态设置为false
1330
1375
  liveStatus = false;
1331
1376
  // 判断是否信息是否获取成功
1332
- if (!(await useMasterAndLiveRoomInfo())) {
1377
+ if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.StopBroadcast))) {
1333
1378
  // 未获取成功,直接返回
1334
1379
  return this.sendPrivateMsg("获取直播间信息失败,推送直播下播卡片失败!");
1335
1380
  }
1336
1381
  // 更改直播时长
1337
1382
  liveRoomInfo.live_time = liveTime;
1383
+ // 获取粉丝数变化
1384
+ const followerChange = masterInfo.liveFollowerChange.toString();
1338
1385
  // 定义下播播通知语
1339
1386
  const liveEndMsg = this.config.customLiveEnd
1340
1387
  ? this.config.customLiveEnd
1341
1388
  .replace("-name", masterInfo.username)
1342
1389
  .replace("-time", await this.ctx.gi.getTimeDifference(liveTime))
1390
+ .replace("-follower_change", followerChange)
1343
1391
  : null;
1344
1392
  // 推送通知卡片
1345
1393
  await this.sendLiveNotifyCard({
@@ -1347,7 +1395,7 @@ class ComRegister {
1347
1395
  userface: masterInfo.userface,
1348
1396
  target,
1349
1397
  data: liveRoomInfo,
1350
- }, LiveType.StopBroadcast, liveEndMsg);
1398
+ }, type_1.LiveType.StopBroadcast, followerChange, liveEndMsg);
1351
1399
  // 关闭定时推送定时器
1352
1400
  pushAtTimeTimer();
1353
1401
  // 将推送定时器变量置空
@@ -1356,15 +1404,23 @@ class ComRegister {
1356
1404
  };
1357
1405
  // 启动直播间弹幕监测
1358
1406
  await this.ctx.bl.startLiveRoomListener(roomId, handler);
1407
+ // 第一次启动获取信息并判信息是否获取成功
1408
+ if (!(await useMasterAndLiveRoomInfo(type_1.LiveType.FirstLiveBroadcast))) {
1409
+ // 未获取成功,直接返回
1410
+ return this.sendPrivateMsg("获取直播间信息失败,启动直播间弹幕检测失败!");
1411
+ }
1359
1412
  // 判断直播状态
1360
1413
  if (liveRoomInfo.live_status === 1) {
1361
1414
  // 设置开播时间
1362
1415
  liveTime = liveRoomInfo.live_time;
1416
+ // 获取当前累计观看人数
1417
+ const watched = watchedNum?.toString() || '暂未获取到';
1363
1418
  // 定义直播中通知消息
1364
1419
  const liveMsg = this.config.customLive
1365
1420
  ? this.config.customLive
1366
1421
  .replace("-name", masterInfo.username)
1367
1422
  .replace("-time", await this.ctx.gi.getTimeDifference(liveTime))
1423
+ .replace("-watched", watched)
1368
1424
  .replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`)
1369
1425
  : null;
1370
1426
  // 发送直播通知卡片
@@ -1374,7 +1430,7 @@ class ComRegister {
1374
1430
  userface: masterInfo.userface,
1375
1431
  target,
1376
1432
  data: liveRoomInfo,
1377
- }, LiveType.LiveBroadcast, liveMsg);
1433
+ }, type_1.LiveType.LiveBroadcast, watched, liveMsg);
1378
1434
  }
1379
1435
  // 正在直播,开启定时器
1380
1436
  // 判断定时器是否已开启
@@ -1575,14 +1631,15 @@ class ComRegister {
1575
1631
  // 发送提示
1576
1632
  this.logger.warn(`UID:${sub.uid} 用户没有开通直播间,无法订阅直播!`);
1577
1633
  }
1578
- //
1634
+ // 直播类型模式匹配
1579
1635
  const liveDetectModeSelector = {
1580
1636
  API: async () => {
1581
1637
  // 判断是否已开启直播检测
1582
1638
  if (!this.liveDispose) {
1583
1639
  // 未开启直播检测
1584
1640
  // 开启直播检测并保存销毁函数
1585
- this.liveDispose = await this.liveDetectWithAPI();
1641
+ // this.liveDispose = await this.liveDetectWithAPI();
1642
+ this.logger.warn("API模式暂时不可用");
1586
1643
  }
1587
1644
  },
1588
1645
  WS: async () => {
@@ -8,7 +8,7 @@ declare class GenerateImg extends Service {
8
8
  static inject: string[];
9
9
  giConfig: GenerateImg.Config;
10
10
  constructor(ctx: Context, config: GenerateImg.Config);
11
- generateLiveImg(data: any, username: string, userface: string, liveStatus: number): Promise<{
11
+ generateLiveImg(data: any, username: string, userface: string, followerDisplay: string, liveStatus: number): Promise<{
12
12
  buffer: Buffer<ArrayBufferLike>;
13
13
  pic?: undefined;
14
14
  } | {
@@ -45,6 +45,7 @@ declare namespace GenerateImg {
45
45
  enableLargeFont: boolean;
46
46
  font: string;
47
47
  hideDesc: boolean;
48
+ followerDisplay: boolean;
48
49
  }
49
50
  const Config: Schema<Config>;
50
51
  }
@@ -9,24 +9,16 @@ const DYNAMIC_TYPE_NONE = "DYNAMIC_TYPE_NONE";
9
9
  const DYNAMIC_TYPE_FORWARD = "DYNAMIC_TYPE_FORWARD";
10
10
  const DYNAMIC_TYPE_AV = "DYNAMIC_TYPE_AV";
11
11
  const DYNAMIC_TYPE_PGC = "DYNAMIC_TYPE_PGC";
12
- const DYNAMIC_TYPE_COURSES = "DYNAMIC_TYPE_COURSES";
13
12
  const DYNAMIC_TYPE_WORD = "DYNAMIC_TYPE_WORD";
14
13
  const DYNAMIC_TYPE_DRAW = "DYNAMIC_TYPE_DRAW";
15
14
  const DYNAMIC_TYPE_ARTICLE = "DYNAMIC_TYPE_ARTICLE";
16
15
  const DYNAMIC_TYPE_MUSIC = "DYNAMIC_TYPE_MUSIC";
17
16
  const DYNAMIC_TYPE_COMMON_SQUARE = "DYNAMIC_TYPE_COMMON_SQUARE";
18
- const DYNAMIC_TYPE_COMMON_VERTICAL = "DYNAMIC_TYPE_COMMON_VERTICAL";
19
17
  const DYNAMIC_TYPE_LIVE = "DYNAMIC_TYPE_LIVE";
20
18
  const DYNAMIC_TYPE_MEDIALIST = "DYNAMIC_TYPE_MEDIALIST";
21
19
  const DYNAMIC_TYPE_COURSES_SEASON = "DYNAMIC_TYPE_COURSES_SEASON";
22
- const DYNAMIC_TYPE_COURSES_BATCH = "DYNAMIC_TYPE_COURSES_BATCH";
23
- const DYNAMIC_TYPE_AD = "DYNAMIC_TYPE_AD";
24
- const DYNAMIC_TYPE_APPLET = "DYNAMIC_TYPE_APPLET";
25
- const DYNAMIC_TYPE_SUBSCRIPTION = "DYNAMIC_TYPE_SUBSCRIPTION";
26
20
  const DYNAMIC_TYPE_LIVE_RCMD = "DYNAMIC_TYPE_LIVE_RCMD";
27
- const DYNAMIC_TYPE_BANNER = "DYNAMIC_TYPE_BANNER";
28
21
  const DYNAMIC_TYPE_UGC_SEASON = "DYNAMIC_TYPE_UGC_SEASON";
29
- const DYNAMIC_TYPE_SUBSCRIPTION_NEW = "DYNAMIC_TYPE_SUBSCRIPTION_NEW";
30
22
  // 内容卡片类型
31
23
  const ADDITIONAL_TYPE_RESERVE = "ADDITIONAL_TYPE_RESERVE";
32
24
  class GenerateImg extends koishi_1.Service {
@@ -38,12 +30,12 @@ class GenerateImg extends koishi_1.Service {
38
30
  }
39
31
  async generateLiveImg(
40
32
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
41
- data, username, userface, liveStatus /*0未开播 1刚开播 2已开播 3停止直播*/) {
33
+ data, username, userface, followerDisplay, liveStatus /*0未开播 1刚开播 2已开播 3停止直播*/) {
42
34
  const [titleStatus, liveTime, cover] = await this.getLiveStatus(data.live_time, liveStatus);
43
35
  // 加载字体
44
36
  const fontURL = (0, node_url_1.pathToFileURL)((0, node_path_1.resolve)(__dirname, "font/HYZhengYuan-75W.ttf"));
45
37
  // 卡片内容
46
- const html = `
38
+ const html = /* html */ `
47
39
  <!DOCTYPE html>
48
40
  <html>
49
41
  <head>
@@ -175,6 +167,18 @@ class GenerateImg extends koishi_1.Service {
175
167
  </p>
176
168
  <p class="card-link">
177
169
  <span>${liveTime}</span>
170
+ ${this.giConfig.followerDisplay
171
+ ? /* html */ `
172
+ <span>
173
+ ${liveStatus === 1
174
+ ? `当前粉丝数为${followerDisplay}`
175
+ : liveStatus === 2
176
+ ? `本场直播累计观看人数:${followerDisplay}`
177
+ : liveStatus === 3
178
+ ? `本场直播粉丝数变化:${followerDisplay}`
179
+ : ""}
180
+ </span>`
181
+ : ""}
178
182
  </p>
179
183
  </div>
180
184
  </div>
@@ -260,7 +264,7 @@ class GenerateImg extends koishi_1.Service {
260
264
  if (module_dynamic.desc) {
261
265
  const richText = module_dynamic.desc.rich_text_nodes.reduce((accumulator, currentValue) => {
262
266
  if (currentValue.emoji) {
263
- return `${accumulator}<img style="width:28px; height:28px;" src="${currentValue.emoji.icon_url}"/>`;
267
+ return /* html */ `${accumulator}<img style="width:28px; height:28px;" src="${currentValue.emoji.icon_url}"/>`;
264
268
  }
265
269
  return accumulator + currentValue.text;
266
270
  }, "");
@@ -282,7 +286,7 @@ class GenerateImg extends koishi_1.Service {
282
286
  const text = richText.replace(/\n/g, "<br>");
283
287
  // 拼接字符串
284
288
  if (text) {
285
- main += `
289
+ main += /* html */ `
286
290
  <div class="card-details">
287
291
  ${text}
288
292
  </div>
@@ -297,7 +301,7 @@ class GenerateImg extends koishi_1.Service {
297
301
  const height = module_dynamic.major.draw.items[0].height;
298
302
  console.log(height);
299
303
  if (height > 3000) {
300
- major += `
304
+ major += /* html */ `
301
305
  <div class="single-photo-container">
302
306
  <img class="single-photo-item" src="${module_dynamic.major.draw.items[0].src}"/>
303
307
  <div class="single-photo-mask">
@@ -308,7 +312,7 @@ class GenerateImg extends koishi_1.Service {
308
312
  `;
309
313
  }
310
314
  else {
311
- major += `
315
+ major += /* html */ `
312
316
  <div class="single-photo-container">
313
317
  <img class="single-photo-item" src="${module_dynamic.major.draw.items[0].src}"/>
314
318
  </div>
@@ -317,15 +321,15 @@ class GenerateImg extends koishi_1.Service {
317
321
  }
318
322
  else if (module_dynamic.major.draw.items.length === 4) {
319
323
  major += module_dynamic.major.draw.items.reduce((acc, cV) => {
320
- return `${acc}<img class="four-photo-item" src="${cV.src}"/>`;
324
+ return /* html */ `${acc}<img class="four-photo-item" src="${cV.src}"/>`;
321
325
  }, "");
322
326
  }
323
327
  else {
324
328
  major += module_dynamic.major.draw.items.reduce((acc, cV) => {
325
- return `${acc}<img class="photo-item" src="${cV.src}"/>`;
329
+ return /* html */ `${acc}<img class="photo-item" src="${cV.src}"/>`;
326
330
  }, "");
327
331
  }
328
- main += `
332
+ main += /* html */ `
329
333
  <div class="card-major">
330
334
  ${major}
331
335
  </div>
@@ -353,7 +357,7 @@ class GenerateImg extends koishi_1.Service {
353
357
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
354
358
  const [forwardMain, _, forwardInfo] = await getDynamicMajor(dynamicMajorData.orig, true);
355
359
  // 拼接main
356
- main += `
360
+ main += /* html */ `
357
361
  <div class="card-forward">
358
362
  <div class="forward-userinfo">
359
363
  <img class="forward-avatar" src="${forwardUserAvatarUrl}" alt="avatar">
@@ -377,14 +381,14 @@ class GenerateImg extends koishi_1.Service {
377
381
  let button;
378
382
  // 判断按钮类型
379
383
  if (reserve.button.uncheck.text === "已结束") {
380
- button = `
384
+ button = /* html */ `
381
385
  <button class="reserve-button-end">
382
386
  <span>${reserve.button.uncheck.text}</span>
383
387
  </button>
384
388
  `;
385
389
  }
386
390
  else {
387
- button = `
391
+ button = /* html */ `
388
392
  <button class="reserve-button-ing">
389
393
  <svg class="bili-dyn-card-reserve__action__icon" style="width: 16px; height: 16px;"
390
394
  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -403,7 +407,7 @@ class GenerateImg extends koishi_1.Service {
403
407
  </button>
404
408
  `;
405
409
  }
406
- main += `
410
+ main += /* html */ `
407
411
  <div class="card-reserve">
408
412
  <div class="reserve-main">
409
413
  <div class="reserve-title">
@@ -472,7 +476,7 @@ class GenerateImg extends koishi_1.Service {
472
476
  pubTime = `${pubTime} · 投稿了视频`;
473
477
  }
474
478
  }
475
- main += `
479
+ main += /* html */ `
476
480
  <div class="card-video">
477
481
  <div class="video-cover">
478
482
  <img src="${archive.cover}"
@@ -1302,7 +1306,7 @@ class GenerateImg extends koishi_1.Service {
1302
1306
  `;
1303
1307
  }
1304
1308
  // 定义卡片内容
1305
- const html = `
1309
+ const html = /* html */ `
1306
1310
  <!DOCTYPE html>
1307
1311
  <html>
1308
1312
  <head>
@@ -1428,7 +1432,7 @@ class GenerateImg extends koishi_1.Service {
1428
1432
  async generateWordCloudImg() {
1429
1433
  const page = await this.ctx.puppeteer.page();
1430
1434
  // 创建HTML内容
1431
- const htmlContent = `
1435
+ const htmlContent = /* html */ `
1432
1436
  <!DOCTYPE html>
1433
1437
  <html>
1434
1438
  <head>
@@ -1549,6 +1553,7 @@ class GenerateImg extends koishi_1.Service {
1549
1553
  enableLargeFont: koishi_1.Schema.boolean(),
1550
1554
  font: koishi_1.Schema.string(),
1551
1555
  hideDesc: koishi_1.Schema.boolean(),
1556
+ followerDisplay: koishi_1.Schema.boolean(),
1552
1557
  });
1553
1558
  })(GenerateImg || (GenerateImg = {}));
1554
1559
  exports.default = GenerateImg;
package/lib/index.d.ts CHANGED
@@ -51,6 +51,7 @@ export interface Config {
51
51
  customLiveStart: string;
52
52
  customLive: string;
53
53
  customLiveEnd: string;
54
+ followerDisplay: boolean;
54
55
  hideDesc: boolean;
55
56
  style: {};
56
57
  removeBorder: boolean;
package/lib/index.js CHANGED
@@ -157,6 +157,7 @@ class ServerManager extends koishi_1.Service {
157
157
  hideDesc: globalConfig.hideDesc,
158
158
  enableLargeFont: globalConfig.enableLargeFont,
159
159
  font: globalConfig.font,
160
+ followerDisplay: globalConfig.followerDisplay
160
161
  });
161
162
  // CR = ComRegister
162
163
  const cr = this.ctx.plugin(comRegister_1.default, {
@@ -231,11 +232,11 @@ function apply(ctx, config) {
231
232
  globalConfig = config;
232
233
  // 设置提示
233
234
  ctx.notifier.create({
234
- type: 'danger',
235
- content: "3.0.0-alpha.16 全面从指令订阅转移到配置订阅,以前使用指令的订阅需要全部重新填写到订阅配置中",
235
+ type: "danger",
236
+ content: "3.0.0-alpha.16 全面从指令订阅迁移到配置订阅,以前使用指令的订阅需要全部重新填写到订阅配置中",
236
237
  });
237
238
  ctx.notifier.create({
238
- type: 'warning',
239
+ type: "warning",
239
240
  content: "请使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令。",
240
241
  });
241
242
  // load database
@@ -352,12 +353,17 @@ exports.Config = koishi_1.Schema.object({
352
353
  .default(1)
353
354
  .description("设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时"),
354
355
  customLiveStart: koishi_1.Schema.string()
355
- .default("-name开播啦 -link")
356
- .description("自定义开播提示语,-name代表UP昵称,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦"),
357
- customLive: koishi_1.Schema.string().description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx"),
356
+ .default("-name开播啦,当前粉丝数为-follower -link")
357
+ .description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦"),
358
+ customLive: koishi_1.Schema.string()
359
+ .default("-name正在直播,目前已播-time,直播间累计看过人数为-watched,-link")
360
+ .description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-watched代表累计看过人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx"),
358
361
  customLiveEnd: koishi_1.Schema.string()
359
- .default("-name下播啦,本次直播了-time")
360
- .description("自定义下播提示语,-name代表UP昵称,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
362
+ .default("-name下播啦,本次直播了-time,粉丝数的变化-follower_change")
363
+ .description("自定义下播提示语,-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
364
+ followerDisplay: koishi_1.Schema.boolean()
365
+ .default(true)
366
+ .description("粉丝数变化和看过本场直播的人数是否显示在推送卡片中"),
361
367
  hideDesc: koishi_1.Schema.boolean()
362
368
  .default(false)
363
369
  .description("是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介"),
@@ -0,0 +1,37 @@
1
+ export declare enum LiveType {
2
+ NotLiveBroadcast = 0,
3
+ StartBroadcasting = 1,
4
+ LiveBroadcast = 2,
5
+ StopBroadcast = 3,
6
+ FirstLiveBroadcast = 4
7
+ }
8
+ export type ChannelIdArr = Array<{
9
+ channelId: string;
10
+ dynamic: boolean;
11
+ live: boolean;
12
+ liveGuardBuy: boolean;
13
+ atAll: boolean;
14
+ }>;
15
+ export type TargetItem = {
16
+ channelIdArr: ChannelIdArr;
17
+ platform: string;
18
+ };
19
+ export type Target = Array<TargetItem>;
20
+ export type SubItem = {
21
+ id: number;
22
+ uid: string;
23
+ roomId: string;
24
+ target: Target;
25
+ platform: string;
26
+ live: boolean;
27
+ dynamic: boolean;
28
+ };
29
+ export type SubManager = Array<SubItem>;
30
+ export type MasterInfo = {
31
+ username: string;
32
+ userface: string;
33
+ roomId: number;
34
+ liveOpenFollowerNum: number;
35
+ liveEndFollowerNum: number;
36
+ liveFollowerChange: number;
37
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LiveType = void 0;
4
+ var LiveType;
5
+ (function (LiveType) {
6
+ LiveType[LiveType["NotLiveBroadcast"] = 0] = "NotLiveBroadcast";
7
+ LiveType[LiveType["StartBroadcasting"] = 1] = "StartBroadcasting";
8
+ LiveType[LiveType["LiveBroadcast"] = 2] = "LiveBroadcast";
9
+ LiveType[LiveType["StopBroadcast"] = 3] = "StopBroadcast";
10
+ LiveType[LiveType["FirstLiveBroadcast"] = 4] = "FirstLiveBroadcast";
11
+ })(LiveType || (exports.LiveType = LiveType = {}));
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": "3.0.0-alpha.16",
4
+ "version": "3.0.0-alpha.17",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -196,6 +196,7 @@
196
196
  - ver 3.0.0-alpha.14 优化:移除不需要的服务
197
197
  - ver 3.0.0-alpha.15 修复:启动插件提示发送群组消息失败、直播推送时间显示为负数(不用再特别设置系统时区为UTC+8)
198
198
  - ver 3.0.0-alpha.16 重大更新:订阅不再依赖数据库,从指令订阅全面迁移到配置订阅; 修复:直播时长有误; 优化:`bili show` 指令更改为 `bili list`
199
+ - ver 3.0.0-alpha.17 新增:更多的提示语变量,开播,当前粉丝数。正在直播,累计观看人数。下播,粉丝数变化。选项,新增的提示语变量是否展示到推送卡片中
199
200
 
200
201
  ## 交流群
201
202