koishi-plugin-bilibili-notify 3.3.11-alpha.3 → 3.3.11-alpha.4
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/lib/index.js +11 -8
- package/lib/index.mjs +11 -8
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1237,10 +1237,7 @@ var ComRegister = class {
|
|
|
1237
1237
|
let liveStatus = false;
|
|
1238
1238
|
let liveRoomInfo;
|
|
1239
1239
|
let masterInfo;
|
|
1240
|
-
const liveData = {
|
|
1241
|
-
watchedNum: "0",
|
|
1242
|
-
likedNum: "0"
|
|
1243
|
-
};
|
|
1240
|
+
const liveData = { likedNum: "0" };
|
|
1244
1241
|
const liveMsgObj = this.liveMsgManager.get(sub.uid);
|
|
1245
1242
|
const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
|
|
1246
1243
|
this.logger.info("开始制作弹幕词云");
|
|
@@ -1283,8 +1280,9 @@ var ComRegister = class {
|
|
|
1283
1280
|
}
|
|
1284
1281
|
liveTime = liveRoomInfo.live_time;
|
|
1285
1282
|
const watched = liveData.watchedNum || "暂未获取到";
|
|
1283
|
+
liveData.watchedNum = watched;
|
|
1286
1284
|
const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
|
|
1287
|
-
await this.sendLiveNotifyCard(LiveType.LiveBroadcast,
|
|
1285
|
+
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, liveData, {
|
|
1288
1286
|
liveRoomInfo,
|
|
1289
1287
|
masterInfo,
|
|
1290
1288
|
cardStyle: sub.customCardStyle
|
|
@@ -1339,7 +1337,9 @@ var ComRegister = class {
|
|
|
1339
1337
|
liveData.watchedNum = body.text_small;
|
|
1340
1338
|
},
|
|
1341
1339
|
onLikedChange: ({ body }) => {
|
|
1340
|
+
console.log(body.count);
|
|
1342
1341
|
liveData.likedNum = body.count.toString();
|
|
1342
|
+
console.log(liveData.likedNum);
|
|
1343
1343
|
},
|
|
1344
1344
|
onGuardBuy: ({ body }) => {
|
|
1345
1345
|
const content = (0, koishi.h)("message", [koishi.h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`)]);
|
|
@@ -1366,8 +1366,9 @@ var ComRegister = class {
|
|
|
1366
1366
|
liveTime = liveRoomInfo?.live_time || luxon.DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
|
|
1367
1367
|
const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
|
|
1368
1368
|
const followerNum = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
|
|
1369
|
+
liveData.fansNum = followerNum;
|
|
1369
1370
|
const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower", followerNum).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
|
|
1370
|
-
await this.sendLiveNotifyCard(LiveType.StartBroadcasting,
|
|
1371
|
+
await this.sendLiveNotifyCard(LiveType.StartBroadcasting, liveData, {
|
|
1371
1372
|
liveRoomInfo,
|
|
1372
1373
|
masterInfo,
|
|
1373
1374
|
cardStyle: sub.customCardStyle
|
|
@@ -1402,8 +1403,9 @@ var ComRegister = class {
|
|
|
1402
1403
|
if (liveFollowerChangeNum > 0) return liveFollowerChangeNum >= 1e4 ? `+${(liveFollowerChangeNum / 1e4).toFixed(1)}万` : `+${liveFollowerChangeNum}`;
|
|
1403
1404
|
return liveFollowerChangeNum <= -1e4 ? `${(liveFollowerChangeNum / 1e4).toFixed(1)}万` : liveFollowerChangeNum.toString();
|
|
1404
1405
|
})();
|
|
1406
|
+
liveData.fansChanged = followerChange;
|
|
1405
1407
|
const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
|
|
1406
|
-
await this.sendLiveNotifyCard(LiveType.StopBroadcast,
|
|
1408
|
+
await this.sendLiveNotifyCard(LiveType.StopBroadcast, liveData, {
|
|
1407
1409
|
liveRoomInfo,
|
|
1408
1410
|
masterInfo,
|
|
1409
1411
|
cardStyle: sub.customCardStyle
|
|
@@ -1422,8 +1424,9 @@ var ComRegister = class {
|
|
|
1422
1424
|
if (liveRoomInfo.live_status === 1) {
|
|
1423
1425
|
liveTime = liveRoomInfo.live_time;
|
|
1424
1426
|
const watched = liveData.watchedNum || "暂未获取到";
|
|
1427
|
+
liveData.watchedNum = watched;
|
|
1425
1428
|
const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
|
|
1426
|
-
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast,
|
|
1429
|
+
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, liveData, {
|
|
1427
1430
|
liveRoomInfo,
|
|
1428
1431
|
masterInfo,
|
|
1429
1432
|
cardStyle: sub.customCardStyle
|
package/lib/index.mjs
CHANGED
|
@@ -1219,10 +1219,7 @@ var ComRegister = class {
|
|
|
1219
1219
|
let liveStatus = false;
|
|
1220
1220
|
let liveRoomInfo;
|
|
1221
1221
|
let masterInfo;
|
|
1222
|
-
const liveData = {
|
|
1223
|
-
watchedNum: "0",
|
|
1224
|
-
likedNum: "0"
|
|
1225
|
-
};
|
|
1222
|
+
const liveData = { likedNum: "0" };
|
|
1226
1223
|
const liveMsgObj = this.liveMsgManager.get(sub.uid);
|
|
1227
1224
|
const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
|
|
1228
1225
|
this.logger.info("开始制作弹幕词云");
|
|
@@ -1265,8 +1262,9 @@ var ComRegister = class {
|
|
|
1265
1262
|
}
|
|
1266
1263
|
liveTime = liveRoomInfo.live_time;
|
|
1267
1264
|
const watched = liveData.watchedNum || "暂未获取到";
|
|
1265
|
+
liveData.watchedNum = watched;
|
|
1268
1266
|
const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
|
|
1269
|
-
await this.sendLiveNotifyCard(LiveType.LiveBroadcast,
|
|
1267
|
+
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, liveData, {
|
|
1270
1268
|
liveRoomInfo,
|
|
1271
1269
|
masterInfo,
|
|
1272
1270
|
cardStyle: sub.customCardStyle
|
|
@@ -1321,7 +1319,9 @@ var ComRegister = class {
|
|
|
1321
1319
|
liveData.watchedNum = body.text_small;
|
|
1322
1320
|
},
|
|
1323
1321
|
onLikedChange: ({ body }) => {
|
|
1322
|
+
console.log(body.count);
|
|
1324
1323
|
liveData.likedNum = body.count.toString();
|
|
1324
|
+
console.log(liveData.likedNum);
|
|
1325
1325
|
},
|
|
1326
1326
|
onGuardBuy: ({ body }) => {
|
|
1327
1327
|
const content = h("message", [h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`)]);
|
|
@@ -1348,8 +1348,9 @@ var ComRegister = class {
|
|
|
1348
1348
|
liveTime = liveRoomInfo?.live_time || DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
|
|
1349
1349
|
const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
|
|
1350
1350
|
const followerNum = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
|
|
1351
|
+
liveData.fansNum = followerNum;
|
|
1351
1352
|
const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower", followerNum).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
|
|
1352
|
-
await this.sendLiveNotifyCard(LiveType.StartBroadcasting,
|
|
1353
|
+
await this.sendLiveNotifyCard(LiveType.StartBroadcasting, liveData, {
|
|
1353
1354
|
liveRoomInfo,
|
|
1354
1355
|
masterInfo,
|
|
1355
1356
|
cardStyle: sub.customCardStyle
|
|
@@ -1384,8 +1385,9 @@ var ComRegister = class {
|
|
|
1384
1385
|
if (liveFollowerChangeNum > 0) return liveFollowerChangeNum >= 1e4 ? `+${(liveFollowerChangeNum / 1e4).toFixed(1)}万` : `+${liveFollowerChangeNum}`;
|
|
1385
1386
|
return liveFollowerChangeNum <= -1e4 ? `${(liveFollowerChangeNum / 1e4).toFixed(1)}万` : liveFollowerChangeNum.toString();
|
|
1386
1387
|
})();
|
|
1388
|
+
liveData.fansChanged = followerChange;
|
|
1387
1389
|
const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
|
|
1388
|
-
await this.sendLiveNotifyCard(LiveType.StopBroadcast,
|
|
1390
|
+
await this.sendLiveNotifyCard(LiveType.StopBroadcast, liveData, {
|
|
1389
1391
|
liveRoomInfo,
|
|
1390
1392
|
masterInfo,
|
|
1391
1393
|
cardStyle: sub.customCardStyle
|
|
@@ -1404,8 +1406,9 @@ var ComRegister = class {
|
|
|
1404
1406
|
if (liveRoomInfo.live_status === 1) {
|
|
1405
1407
|
liveTime = liveRoomInfo.live_time;
|
|
1406
1408
|
const watched = liveData.watchedNum || "暂未获取到";
|
|
1409
|
+
liveData.watchedNum = watched;
|
|
1407
1410
|
const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
|
|
1408
|
-
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast,
|
|
1411
|
+
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, liveData, {
|
|
1409
1412
|
liveRoomInfo,
|
|
1410
1413
|
masterInfo,
|
|
1411
1414
|
cardStyle: sub.customCardStyle
|