koishi-plugin-bilibili-notify 3.3.11-alpha.1 → 3.3.11-alpha.3
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 +54 -44
- package/lib/index.mjs +54 -44
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -175,6 +175,11 @@ async function withRetry(fn, maxAttempts = 3, delayMs = 1e3) {
|
|
|
175
175
|
await new Promise((resolve$1) => setTimeout(resolve$1, delayMs * attempt));
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
+
function replaceButKeep(oldObj, newObj, keepKeys) {
|
|
179
|
+
const result = { ...newObj };
|
|
180
|
+
for (const key of keepKeys) result[key] = oldObj[key];
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
178
183
|
|
|
179
184
|
//#endregion
|
|
180
185
|
//#region src/type/index.ts
|
|
@@ -340,10 +345,11 @@ const stopwords = new Set([
|
|
|
340
345
|
"之前",
|
|
341
346
|
"某天"
|
|
342
347
|
]);
|
|
348
|
+
var stop_words_default = stopwords;
|
|
343
349
|
|
|
344
350
|
//#endregion
|
|
345
351
|
//#region src/command_register.ts
|
|
346
|
-
var ComRegister
|
|
352
|
+
var ComRegister = class {
|
|
347
353
|
static inject = [
|
|
348
354
|
"bilibili-notify",
|
|
349
355
|
"bilibili-notify-api",
|
|
@@ -726,11 +732,11 @@ var ComRegister$1 = class {
|
|
|
726
732
|
}
|
|
727
733
|
mergeStopWords(stopWordsStr) {
|
|
728
734
|
if (!stopWordsStr || stopWordsStr.trim() === "") {
|
|
729
|
-
this.stopwords = new Set(
|
|
735
|
+
this.stopwords = new Set(stop_words_default);
|
|
730
736
|
return;
|
|
731
737
|
}
|
|
732
738
|
const additionalStopWords = stopWordsStr.split(",").map((word) => word.trim()).filter((word) => word !== "");
|
|
733
|
-
this.stopwords = new Set([...
|
|
739
|
+
this.stopwords = new Set([...stop_words_default, ...additionalStopWords]);
|
|
734
740
|
}
|
|
735
741
|
initManagerAfterLoadSub() {
|
|
736
742
|
for (const [uid, sub] of this.subManager) {
|
|
@@ -1205,9 +1211,9 @@ var ComRegister$1 = class {
|
|
|
1205
1211
|
}
|
|
1206
1212
|
return data;
|
|
1207
1213
|
}
|
|
1208
|
-
async sendLiveNotifyCard(liveType,
|
|
1214
|
+
async sendLiveNotifyCard(liveType, liveData, liveInfo, uid, liveNotifyMsg) {
|
|
1209
1215
|
const buffer = await withRetry(async () => {
|
|
1210
|
-
return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface,
|
|
1216
|
+
return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface, liveData, liveType, liveInfo.cardStyle.enable ? liveInfo.cardStyle : void 0);
|
|
1211
1217
|
}, 1).catch((e) => {
|
|
1212
1218
|
this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e.message}`);
|
|
1213
1219
|
});
|
|
@@ -1231,7 +1237,10 @@ var ComRegister$1 = class {
|
|
|
1231
1237
|
let liveStatus = false;
|
|
1232
1238
|
let liveRoomInfo;
|
|
1233
1239
|
let masterInfo;
|
|
1234
|
-
|
|
1240
|
+
const liveData = {
|
|
1241
|
+
watchedNum: "0",
|
|
1242
|
+
likedNum: "0"
|
|
1243
|
+
};
|
|
1235
1244
|
const liveMsgObj = this.liveMsgManager.get(sub.uid);
|
|
1236
1245
|
const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
|
|
1237
1246
|
this.logger.info("开始制作弹幕词云");
|
|
@@ -1273,9 +1282,9 @@ var ComRegister$1 = class {
|
|
|
1273
1282
|
return;
|
|
1274
1283
|
}
|
|
1275
1284
|
liveTime = liveRoomInfo.live_time;
|
|
1276
|
-
const watched = watchedNum || "暂未获取到";
|
|
1285
|
+
const watched = liveData.watchedNum || "暂未获取到";
|
|
1277
1286
|
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}`);
|
|
1278
|
-
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
|
|
1287
|
+
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: watched }, {
|
|
1279
1288
|
liveRoomInfo,
|
|
1280
1289
|
masterInfo,
|
|
1281
1290
|
cardStyle: sub.customCardStyle
|
|
@@ -1298,11 +1307,11 @@ var ComRegister$1 = class {
|
|
|
1298
1307
|
flag = false;
|
|
1299
1308
|
return flag;
|
|
1300
1309
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1310
|
+
if (liveType === LiveType.StartBroadcasting || liveType === LiveType.FirstLiveBroadcast) {
|
|
1311
|
+
liveRoomInfo = data;
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
liveRoomInfo = replaceButKeep(liveRoomInfo, data, ["live_time"]);
|
|
1306
1315
|
};
|
|
1307
1316
|
const LIVE_EVENT_COOLDOWN = 10 * 1e3;
|
|
1308
1317
|
let lastLiveStart = 0;
|
|
@@ -1327,10 +1336,10 @@ var ComRegister$1 = class {
|
|
|
1327
1336
|
this.broadcastToTargets(sub.uid, content, PushType.Superchat);
|
|
1328
1337
|
},
|
|
1329
1338
|
onWatchedChange: ({ body }) => {
|
|
1330
|
-
watchedNum = body.text_small;
|
|
1339
|
+
liveData.watchedNum = body.text_small;
|
|
1331
1340
|
},
|
|
1332
|
-
|
|
1333
|
-
|
|
1341
|
+
onLikedChange: ({ body }) => {
|
|
1342
|
+
liveData.likedNum = body.count.toString();
|
|
1334
1343
|
},
|
|
1335
1344
|
onGuardBuy: ({ body }) => {
|
|
1336
1345
|
const content = (0, koishi.h)("message", [koishi.h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`)]);
|
|
@@ -1353,12 +1362,12 @@ var ComRegister$1 = class {
|
|
|
1353
1362
|
await this.sendPrivateMsg("获取直播间信息失败,推送直播开播卡片失败!");
|
|
1354
1363
|
return await this.sendPrivateMsgAndStopService();
|
|
1355
1364
|
}
|
|
1356
|
-
this.logger.info(
|
|
1365
|
+
this.logger.info(`房间号:${masterInfo.roomId},开播粉丝数:${masterInfo.liveOpenFollowerNum}`);
|
|
1357
1366
|
liveTime = liveRoomInfo?.live_time || luxon.DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
|
|
1358
1367
|
const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
|
|
1359
|
-
const
|
|
1360
|
-
const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower",
|
|
1361
|
-
await this.sendLiveNotifyCard(LiveType.StartBroadcasting,
|
|
1368
|
+
const followerNum = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
|
|
1369
|
+
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, { fansNum: followerNum }, {
|
|
1362
1371
|
liveRoomInfo,
|
|
1363
1372
|
masterInfo,
|
|
1364
1373
|
cardStyle: sub.customCardStyle
|
|
@@ -1394,7 +1403,7 @@ var ComRegister$1 = class {
|
|
|
1394
1403
|
return liveFollowerChangeNum <= -1e4 ? `${(liveFollowerChangeNum / 1e4).toFixed(1)}万` : liveFollowerChangeNum.toString();
|
|
1395
1404
|
})();
|
|
1396
1405
|
const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
|
|
1397
|
-
await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
|
|
1406
|
+
await this.sendLiveNotifyCard(LiveType.StopBroadcast, { fansChanged: followerChange }, {
|
|
1398
1407
|
liveRoomInfo,
|
|
1399
1408
|
masterInfo,
|
|
1400
1409
|
cardStyle: sub.customCardStyle
|
|
@@ -1412,9 +1421,9 @@ var ComRegister$1 = class {
|
|
|
1412
1421
|
this.logger.info(`当前粉丝数:${masterInfo.liveOpenFollowerNum}`);
|
|
1413
1422
|
if (liveRoomInfo.live_status === 1) {
|
|
1414
1423
|
liveTime = liveRoomInfo.live_time;
|
|
1415
|
-
const watched = watchedNum || "暂未获取到";
|
|
1424
|
+
const watched = liveData.watchedNum || "暂未获取到";
|
|
1416
1425
|
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}`);
|
|
1417
|
-
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
|
|
1426
|
+
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: watched }, {
|
|
1418
1427
|
liveRoomInfo,
|
|
1419
1428
|
masterInfo,
|
|
1420
1429
|
cardStyle: sub.customCardStyle
|
|
@@ -1469,7 +1478,7 @@ var ComRegister$1 = class {
|
|
|
1469
1478
|
LiveAPIStatus.liveStartTimeInit = true;
|
|
1470
1479
|
}
|
|
1471
1480
|
const liveMsg = liveMsgObj.customLive.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-watched", "API模式无法获取").replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
|
|
1472
|
-
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
|
|
1481
|
+
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: "API" }, {
|
|
1473
1482
|
liveRoomInfo: LiveAPIStatus.liveRoomInfo,
|
|
1474
1483
|
masterInfo: LiveAPIStatus.masterInfo,
|
|
1475
1484
|
cardStyle: sub.customCardStyle
|
|
@@ -1502,7 +1511,7 @@ var ComRegister$1 = class {
|
|
|
1502
1511
|
return liveFollowerChangeNum <= -1e4 ? `${liveFollowerChangeNum.toFixed(1)}万` : liveFollowerChangeNum.toString();
|
|
1503
1512
|
})();
|
|
1504
1513
|
const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
|
|
1505
|
-
await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
|
|
1514
|
+
await this.sendLiveNotifyCard(LiveType.StopBroadcast, { fansChanged: followerChange }, {
|
|
1506
1515
|
liveRoomInfo: LiveAPIStatus.liveRoomInfo,
|
|
1507
1516
|
masterInfo: LiveAPIStatus.masterInfo,
|
|
1508
1517
|
cardStyle: sub.customCardStyle
|
|
@@ -1518,9 +1527,9 @@ var ComRegister$1 = class {
|
|
|
1518
1527
|
}
|
|
1519
1528
|
LiveAPIStatus.liveStartTime = LiveAPIStatus.liveRoomInfo.live_time;
|
|
1520
1529
|
LiveAPIStatus.liveStartTimeInit = true;
|
|
1521
|
-
const
|
|
1522
|
-
const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower",
|
|
1523
|
-
await this.sendLiveNotifyCard(LiveType.StartBroadcasting,
|
|
1530
|
+
const followerNum = LiveAPIStatus.masterInfo.liveOpenFollowerNum >= 1e4 ? `${(LiveAPIStatus.masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : LiveAPIStatus.masterInfo.liveOpenFollowerNum.toString();
|
|
1531
|
+
const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower", followerNum).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
|
|
1532
|
+
await this.sendLiveNotifyCard(LiveType.StartBroadcasting, { fansNum: followerNum }, {
|
|
1524
1533
|
liveRoomInfo: LiveAPIStatus.liveRoomInfo,
|
|
1525
1534
|
masterInfo: LiveAPIStatus.masterInfo,
|
|
1526
1535
|
cardStyle: sub.customCardStyle
|
|
@@ -1541,7 +1550,7 @@ var ComRegister$1 = class {
|
|
|
1541
1550
|
LiveAPIStatus.liveStartTimeInit = true;
|
|
1542
1551
|
}
|
|
1543
1552
|
const liveMsg = liveMsgObj.customLive.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-watched", "API模式无法获取").replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
|
|
1544
|
-
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
|
|
1553
|
+
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: "API" }, {
|
|
1545
1554
|
liveRoomInfo: LiveAPIStatus.liveRoomInfo,
|
|
1546
1555
|
masterInfo: LiveAPIStatus.masterInfo,
|
|
1547
1556
|
cardStyle: sub.customCardStyle
|
|
@@ -1858,8 +1867,8 @@ var ComRegister$1 = class {
|
|
|
1858
1867
|
}),
|
|
1859
1868
|
dynamicDebugMode: koishi.Schema.boolean().required()
|
|
1860
1869
|
});
|
|
1861
|
-
})(ComRegister
|
|
1862
|
-
var
|
|
1870
|
+
})(ComRegister || (ComRegister = {}));
|
|
1871
|
+
var command_register_default = ComRegister;
|
|
1863
1872
|
|
|
1864
1873
|
//#endregion
|
|
1865
1874
|
//#region src/database.ts
|
|
@@ -1895,7 +1904,7 @@ const DYNAMIC_TYPE_COURSES_SEASON = "DYNAMIC_TYPE_COURSES_SEASON";
|
|
|
1895
1904
|
const DYNAMIC_TYPE_LIVE_RCMD = "DYNAMIC_TYPE_LIVE_RCMD";
|
|
1896
1905
|
const DYNAMIC_TYPE_UGC_SEASON = "DYNAMIC_TYPE_UGC_SEASON";
|
|
1897
1906
|
const ADDITIONAL_TYPE_RESERVE = "ADDITIONAL_TYPE_RESERVE";
|
|
1898
|
-
var GenerateImg
|
|
1907
|
+
var GenerateImg = class extends koishi.Service {
|
|
1899
1908
|
static inject = ["puppeteer"];
|
|
1900
1909
|
giConfig;
|
|
1901
1910
|
constructor(ctx, config) {
|
|
@@ -1925,7 +1934,7 @@ var GenerateImg$1 = class extends koishi.Service {
|
|
|
1925
1934
|
await page.close();
|
|
1926
1935
|
return buffer;
|
|
1927
1936
|
}
|
|
1928
|
-
async generateLiveImg(data, username, userface,
|
|
1937
|
+
async generateLiveImg(data, username, userface, liveData, liveStatus, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
|
|
1929
1938
|
const [titleStatus, liveTime, cover] = await this.getLiveStatus(data.live_time, liveStatus);
|
|
1930
1939
|
const fontURL = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "font/HYZhengYuan-75W.ttf"));
|
|
1931
1940
|
const html = `
|
|
@@ -2055,14 +2064,14 @@ var GenerateImg$1 = class extends koishi.Service {
|
|
|
2055
2064
|
</div>
|
|
2056
2065
|
${this.giConfig.hideDesc ? "" : `<p class="card-text">${data.description ? data.description : "这个主播很懒,什么简介都没写"}</p>`}
|
|
2057
2066
|
<p class="card-link">
|
|
2058
|
-
<span>${liveStatus === 3 ?
|
|
2067
|
+
<span>${liveStatus === 3 ? `本场直播点赞数:${this.numberToStr(+liveData.likedNum)}` : `人气:${this.numberToStr(data.online)}`}</span>
|
|
2059
2068
|
<span>分区名称:${data.area_name}</span>
|
|
2060
2069
|
</p>
|
|
2061
2070
|
<p class="card-link">
|
|
2062
2071
|
<span>${liveTime}</span>
|
|
2063
2072
|
${this.giConfig.followerDisplay ? `
|
|
2064
2073
|
<span>
|
|
2065
|
-
${liveStatus === 1 ? `当前粉丝数:${
|
|
2074
|
+
${liveStatus === 1 ? `当前粉丝数:${liveData.fansNum || "暂未获取到"}` : liveStatus === 2 ? `${liveData.watchedNum !== "API" ? `累计观看人数:${liveData.watchedNum}` : ""}` : liveStatus === 3 ? `粉丝数变化:${liveData.fansChanged}` : ""}
|
|
2066
2075
|
</span>` : ""}
|
|
2067
2076
|
</p>
|
|
2068
2077
|
</div>
|
|
@@ -3362,8 +3371,8 @@ var GenerateImg$1 = class extends koishi.Service {
|
|
|
3362
3371
|
hideDesc: koishi.Schema.boolean(),
|
|
3363
3372
|
followerDisplay: koishi.Schema.boolean()
|
|
3364
3373
|
});
|
|
3365
|
-
})(GenerateImg
|
|
3366
|
-
var
|
|
3374
|
+
})(GenerateImg || (GenerateImg = {}));
|
|
3375
|
+
var generate_img_default = GenerateImg;
|
|
3367
3376
|
|
|
3368
3377
|
//#endregion
|
|
3369
3378
|
//#region src/bili_api.ts
|
|
@@ -3458,7 +3467,7 @@ const COPY_USER_TO_GROUP = "https://api.bilibili.com/x/relation/tags/copyUsers";
|
|
|
3458
3467
|
const GET_RELATION_GROUP_DETAIL = "https://api.bilibili.com/x/relation/tag";
|
|
3459
3468
|
const GET_LIVE_ROOM_INFO_STREAM_KEY = "https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo";
|
|
3460
3469
|
const GET_LIVE_ROOMS_INFO = "https://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids";
|
|
3461
|
-
var BiliAPI
|
|
3470
|
+
var BiliAPI = class extends koishi.Service {
|
|
3462
3471
|
static inject = ["database", "notifier"];
|
|
3463
3472
|
jar;
|
|
3464
3473
|
client;
|
|
@@ -4140,8 +4149,8 @@ var BiliAPI$1 = class extends koishi.Service {
|
|
|
4140
4149
|
userAgent: koishi.Schema.string(),
|
|
4141
4150
|
key: koishi.Schema.string().pattern(/^[0-9a-f]{32}$/).required()
|
|
4142
4151
|
});
|
|
4143
|
-
})(BiliAPI
|
|
4144
|
-
var
|
|
4152
|
+
})(BiliAPI || (BiliAPI = {}));
|
|
4153
|
+
var bili_api_default = BiliAPI;
|
|
4145
4154
|
|
|
4146
4155
|
//#endregion
|
|
4147
4156
|
//#region src/bili_live.ts
|
|
@@ -4174,6 +4183,7 @@ var BLive = class extends koishi.Service {
|
|
|
4174
4183
|
this.logger.warn(`${roomId}直播间连接未成功关闭`);
|
|
4175
4184
|
}
|
|
4176
4185
|
};
|
|
4186
|
+
var bili_live_default = BLive;
|
|
4177
4187
|
|
|
4178
4188
|
//#endregion
|
|
4179
4189
|
//#region src/index.ts
|
|
@@ -4215,11 +4225,11 @@ var ServerManager = class extends koishi.Service {
|
|
|
4215
4225
|
registerPlugin = () => {
|
|
4216
4226
|
if (this.servers.length !== 0) return false;
|
|
4217
4227
|
try {
|
|
4218
|
-
const ba = this.ctx.plugin(
|
|
4228
|
+
const ba = this.ctx.plugin(bili_api_default, {
|
|
4219
4229
|
userAgent: globalConfig.userAgent,
|
|
4220
4230
|
key: globalConfig.key
|
|
4221
4231
|
});
|
|
4222
|
-
const gi = this.ctx.plugin(
|
|
4232
|
+
const gi = this.ctx.plugin(generate_img_default, {
|
|
4223
4233
|
filter: globalConfig.filter,
|
|
4224
4234
|
removeBorder: globalConfig.removeBorder,
|
|
4225
4235
|
cardColorStart: globalConfig.cardColorStart,
|
|
@@ -4231,7 +4241,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4231
4241
|
font: globalConfig.font,
|
|
4232
4242
|
followerDisplay: globalConfig.followerDisplay
|
|
4233
4243
|
});
|
|
4234
|
-
const cr = this.ctx.plugin(
|
|
4244
|
+
const cr = this.ctx.plugin(command_register_default, {
|
|
4235
4245
|
advancedSub: globalConfig.advancedSub,
|
|
4236
4246
|
subs: globalConfig.subs,
|
|
4237
4247
|
master: globalConfig.master,
|
|
@@ -4250,7 +4260,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4250
4260
|
filter: globalConfig.filter,
|
|
4251
4261
|
dynamicDebugMode: globalConfig.dynamicDebugMode
|
|
4252
4262
|
});
|
|
4253
|
-
const bl = this.ctx.plugin(
|
|
4263
|
+
const bl = this.ctx.plugin(bili_live_default);
|
|
4254
4264
|
this.servers.push(ba);
|
|
4255
4265
|
this.servers.push(bl);
|
|
4256
4266
|
this.servers.push(gi);
|
package/lib/index.mjs
CHANGED
|
@@ -157,6 +157,11 @@ async function withRetry(fn, maxAttempts = 3, delayMs = 1e3) {
|
|
|
157
157
|
await new Promise((resolve$1) => setTimeout(resolve$1, delayMs * attempt));
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
+
function replaceButKeep(oldObj, newObj, keepKeys) {
|
|
161
|
+
const result = { ...newObj };
|
|
162
|
+
for (const key of keepKeys) result[key] = oldObj[key];
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
160
165
|
|
|
161
166
|
//#endregion
|
|
162
167
|
//#region src/type/index.ts
|
|
@@ -322,10 +327,11 @@ const stopwords = new Set([
|
|
|
322
327
|
"之前",
|
|
323
328
|
"某天"
|
|
324
329
|
]);
|
|
330
|
+
var stop_words_default = stopwords;
|
|
325
331
|
|
|
326
332
|
//#endregion
|
|
327
333
|
//#region src/command_register.ts
|
|
328
|
-
var ComRegister
|
|
334
|
+
var ComRegister = class {
|
|
329
335
|
static inject = [
|
|
330
336
|
"bilibili-notify",
|
|
331
337
|
"bilibili-notify-api",
|
|
@@ -708,11 +714,11 @@ var ComRegister$1 = class {
|
|
|
708
714
|
}
|
|
709
715
|
mergeStopWords(stopWordsStr) {
|
|
710
716
|
if (!stopWordsStr || stopWordsStr.trim() === "") {
|
|
711
|
-
this.stopwords = new Set(
|
|
717
|
+
this.stopwords = new Set(stop_words_default);
|
|
712
718
|
return;
|
|
713
719
|
}
|
|
714
720
|
const additionalStopWords = stopWordsStr.split(",").map((word) => word.trim()).filter((word) => word !== "");
|
|
715
|
-
this.stopwords = new Set([...
|
|
721
|
+
this.stopwords = new Set([...stop_words_default, ...additionalStopWords]);
|
|
716
722
|
}
|
|
717
723
|
initManagerAfterLoadSub() {
|
|
718
724
|
for (const [uid, sub] of this.subManager) {
|
|
@@ -1187,9 +1193,9 @@ var ComRegister$1 = class {
|
|
|
1187
1193
|
}
|
|
1188
1194
|
return data;
|
|
1189
1195
|
}
|
|
1190
|
-
async sendLiveNotifyCard(liveType,
|
|
1196
|
+
async sendLiveNotifyCard(liveType, liveData, liveInfo, uid, liveNotifyMsg) {
|
|
1191
1197
|
const buffer = await withRetry(async () => {
|
|
1192
|
-
return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface,
|
|
1198
|
+
return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface, liveData, liveType, liveInfo.cardStyle.enable ? liveInfo.cardStyle : void 0);
|
|
1193
1199
|
}, 1).catch((e) => {
|
|
1194
1200
|
this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e.message}`);
|
|
1195
1201
|
});
|
|
@@ -1213,7 +1219,10 @@ var ComRegister$1 = class {
|
|
|
1213
1219
|
let liveStatus = false;
|
|
1214
1220
|
let liveRoomInfo;
|
|
1215
1221
|
let masterInfo;
|
|
1216
|
-
|
|
1222
|
+
const liveData = {
|
|
1223
|
+
watchedNum: "0",
|
|
1224
|
+
likedNum: "0"
|
|
1225
|
+
};
|
|
1217
1226
|
const liveMsgObj = this.liveMsgManager.get(sub.uid);
|
|
1218
1227
|
const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
|
|
1219
1228
|
this.logger.info("开始制作弹幕词云");
|
|
@@ -1255,9 +1264,9 @@ var ComRegister$1 = class {
|
|
|
1255
1264
|
return;
|
|
1256
1265
|
}
|
|
1257
1266
|
liveTime = liveRoomInfo.live_time;
|
|
1258
|
-
const watched = watchedNum || "暂未获取到";
|
|
1267
|
+
const watched = liveData.watchedNum || "暂未获取到";
|
|
1259
1268
|
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}`);
|
|
1260
|
-
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
|
|
1269
|
+
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: watched }, {
|
|
1261
1270
|
liveRoomInfo,
|
|
1262
1271
|
masterInfo,
|
|
1263
1272
|
cardStyle: sub.customCardStyle
|
|
@@ -1280,11 +1289,11 @@ var ComRegister$1 = class {
|
|
|
1280
1289
|
flag = false;
|
|
1281
1290
|
return flag;
|
|
1282
1291
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1292
|
+
if (liveType === LiveType.StartBroadcasting || liveType === LiveType.FirstLiveBroadcast) {
|
|
1293
|
+
liveRoomInfo = data;
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
liveRoomInfo = replaceButKeep(liveRoomInfo, data, ["live_time"]);
|
|
1288
1297
|
};
|
|
1289
1298
|
const LIVE_EVENT_COOLDOWN = 10 * 1e3;
|
|
1290
1299
|
let lastLiveStart = 0;
|
|
@@ -1309,10 +1318,10 @@ var ComRegister$1 = class {
|
|
|
1309
1318
|
this.broadcastToTargets(sub.uid, content, PushType.Superchat);
|
|
1310
1319
|
},
|
|
1311
1320
|
onWatchedChange: ({ body }) => {
|
|
1312
|
-
watchedNum = body.text_small;
|
|
1321
|
+
liveData.watchedNum = body.text_small;
|
|
1313
1322
|
},
|
|
1314
|
-
|
|
1315
|
-
|
|
1323
|
+
onLikedChange: ({ body }) => {
|
|
1324
|
+
liveData.likedNum = body.count.toString();
|
|
1316
1325
|
},
|
|
1317
1326
|
onGuardBuy: ({ body }) => {
|
|
1318
1327
|
const content = h("message", [h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`)]);
|
|
@@ -1335,12 +1344,12 @@ var ComRegister$1 = class {
|
|
|
1335
1344
|
await this.sendPrivateMsg("获取直播间信息失败,推送直播开播卡片失败!");
|
|
1336
1345
|
return await this.sendPrivateMsgAndStopService();
|
|
1337
1346
|
}
|
|
1338
|
-
this.logger.info(
|
|
1347
|
+
this.logger.info(`房间号:${masterInfo.roomId},开播粉丝数:${masterInfo.liveOpenFollowerNum}`);
|
|
1339
1348
|
liveTime = liveRoomInfo?.live_time || DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
|
|
1340
1349
|
const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
|
|
1341
|
-
const
|
|
1342
|
-
const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower",
|
|
1343
|
-
await this.sendLiveNotifyCard(LiveType.StartBroadcasting,
|
|
1350
|
+
const followerNum = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
|
|
1351
|
+
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, { fansNum: followerNum }, {
|
|
1344
1353
|
liveRoomInfo,
|
|
1345
1354
|
masterInfo,
|
|
1346
1355
|
cardStyle: sub.customCardStyle
|
|
@@ -1376,7 +1385,7 @@ var ComRegister$1 = class {
|
|
|
1376
1385
|
return liveFollowerChangeNum <= -1e4 ? `${(liveFollowerChangeNum / 1e4).toFixed(1)}万` : liveFollowerChangeNum.toString();
|
|
1377
1386
|
})();
|
|
1378
1387
|
const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
|
|
1379
|
-
await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
|
|
1388
|
+
await this.sendLiveNotifyCard(LiveType.StopBroadcast, { fansChanged: followerChange }, {
|
|
1380
1389
|
liveRoomInfo,
|
|
1381
1390
|
masterInfo,
|
|
1382
1391
|
cardStyle: sub.customCardStyle
|
|
@@ -1394,9 +1403,9 @@ var ComRegister$1 = class {
|
|
|
1394
1403
|
this.logger.info(`当前粉丝数:${masterInfo.liveOpenFollowerNum}`);
|
|
1395
1404
|
if (liveRoomInfo.live_status === 1) {
|
|
1396
1405
|
liveTime = liveRoomInfo.live_time;
|
|
1397
|
-
const watched = watchedNum || "暂未获取到";
|
|
1406
|
+
const watched = liveData.watchedNum || "暂未获取到";
|
|
1398
1407
|
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}`);
|
|
1399
|
-
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
|
|
1408
|
+
if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: watched }, {
|
|
1400
1409
|
liveRoomInfo,
|
|
1401
1410
|
masterInfo,
|
|
1402
1411
|
cardStyle: sub.customCardStyle
|
|
@@ -1451,7 +1460,7 @@ var ComRegister$1 = class {
|
|
|
1451
1460
|
LiveAPIStatus.liveStartTimeInit = true;
|
|
1452
1461
|
}
|
|
1453
1462
|
const liveMsg = liveMsgObj.customLive.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-watched", "API模式无法获取").replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
|
|
1454
|
-
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
|
|
1463
|
+
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: "API" }, {
|
|
1455
1464
|
liveRoomInfo: LiveAPIStatus.liveRoomInfo,
|
|
1456
1465
|
masterInfo: LiveAPIStatus.masterInfo,
|
|
1457
1466
|
cardStyle: sub.customCardStyle
|
|
@@ -1484,7 +1493,7 @@ var ComRegister$1 = class {
|
|
|
1484
1493
|
return liveFollowerChangeNum <= -1e4 ? `${liveFollowerChangeNum.toFixed(1)}万` : liveFollowerChangeNum.toString();
|
|
1485
1494
|
})();
|
|
1486
1495
|
const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
|
|
1487
|
-
await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
|
|
1496
|
+
await this.sendLiveNotifyCard(LiveType.StopBroadcast, { fansChanged: followerChange }, {
|
|
1488
1497
|
liveRoomInfo: LiveAPIStatus.liveRoomInfo,
|
|
1489
1498
|
masterInfo: LiveAPIStatus.masterInfo,
|
|
1490
1499
|
cardStyle: sub.customCardStyle
|
|
@@ -1500,9 +1509,9 @@ var ComRegister$1 = class {
|
|
|
1500
1509
|
}
|
|
1501
1510
|
LiveAPIStatus.liveStartTime = LiveAPIStatus.liveRoomInfo.live_time;
|
|
1502
1511
|
LiveAPIStatus.liveStartTimeInit = true;
|
|
1503
|
-
const
|
|
1504
|
-
const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower",
|
|
1505
|
-
await this.sendLiveNotifyCard(LiveType.StartBroadcasting,
|
|
1512
|
+
const followerNum = LiveAPIStatus.masterInfo.liveOpenFollowerNum >= 1e4 ? `${(LiveAPIStatus.masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : LiveAPIStatus.masterInfo.liveOpenFollowerNum.toString();
|
|
1513
|
+
const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower", followerNum).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
|
|
1514
|
+
await this.sendLiveNotifyCard(LiveType.StartBroadcasting, { fansNum: followerNum }, {
|
|
1506
1515
|
liveRoomInfo: LiveAPIStatus.liveRoomInfo,
|
|
1507
1516
|
masterInfo: LiveAPIStatus.masterInfo,
|
|
1508
1517
|
cardStyle: sub.customCardStyle
|
|
@@ -1523,7 +1532,7 @@ var ComRegister$1 = class {
|
|
|
1523
1532
|
LiveAPIStatus.liveStartTimeInit = true;
|
|
1524
1533
|
}
|
|
1525
1534
|
const liveMsg = liveMsgObj.customLive.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-watched", "API模式无法获取").replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
|
|
1526
|
-
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
|
|
1535
|
+
await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: "API" }, {
|
|
1527
1536
|
liveRoomInfo: LiveAPIStatus.liveRoomInfo,
|
|
1528
1537
|
masterInfo: LiveAPIStatus.masterInfo,
|
|
1529
1538
|
cardStyle: sub.customCardStyle
|
|
@@ -1840,8 +1849,8 @@ var ComRegister$1 = class {
|
|
|
1840
1849
|
}),
|
|
1841
1850
|
dynamicDebugMode: Schema.boolean().required()
|
|
1842
1851
|
});
|
|
1843
|
-
})(ComRegister
|
|
1844
|
-
var
|
|
1852
|
+
})(ComRegister || (ComRegister = {}));
|
|
1853
|
+
var command_register_default = ComRegister;
|
|
1845
1854
|
|
|
1846
1855
|
//#endregion
|
|
1847
1856
|
//#region src/database.ts
|
|
@@ -1877,7 +1886,7 @@ const DYNAMIC_TYPE_COURSES_SEASON = "DYNAMIC_TYPE_COURSES_SEASON";
|
|
|
1877
1886
|
const DYNAMIC_TYPE_LIVE_RCMD = "DYNAMIC_TYPE_LIVE_RCMD";
|
|
1878
1887
|
const DYNAMIC_TYPE_UGC_SEASON = "DYNAMIC_TYPE_UGC_SEASON";
|
|
1879
1888
|
const ADDITIONAL_TYPE_RESERVE = "ADDITIONAL_TYPE_RESERVE";
|
|
1880
|
-
var GenerateImg
|
|
1889
|
+
var GenerateImg = class extends Service {
|
|
1881
1890
|
static inject = ["puppeteer"];
|
|
1882
1891
|
giConfig;
|
|
1883
1892
|
constructor(ctx, config) {
|
|
@@ -1907,7 +1916,7 @@ var GenerateImg$1 = class extends Service {
|
|
|
1907
1916
|
await page.close();
|
|
1908
1917
|
return buffer;
|
|
1909
1918
|
}
|
|
1910
|
-
async generateLiveImg(data, username, userface,
|
|
1919
|
+
async generateLiveImg(data, username, userface, liveData, liveStatus, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
|
|
1911
1920
|
const [titleStatus, liveTime, cover] = await this.getLiveStatus(data.live_time, liveStatus);
|
|
1912
1921
|
const fontURL = pathToFileURL(resolve(__dirname, "font/HYZhengYuan-75W.ttf"));
|
|
1913
1922
|
const html = `
|
|
@@ -2037,14 +2046,14 @@ var GenerateImg$1 = class extends Service {
|
|
|
2037
2046
|
</div>
|
|
2038
2047
|
${this.giConfig.hideDesc ? "" : `<p class="card-text">${data.description ? data.description : "这个主播很懒,什么简介都没写"}</p>`}
|
|
2039
2048
|
<p class="card-link">
|
|
2040
|
-
<span>${liveStatus === 3 ?
|
|
2049
|
+
<span>${liveStatus === 3 ? `本场直播点赞数:${this.numberToStr(+liveData.likedNum)}` : `人气:${this.numberToStr(data.online)}`}</span>
|
|
2041
2050
|
<span>分区名称:${data.area_name}</span>
|
|
2042
2051
|
</p>
|
|
2043
2052
|
<p class="card-link">
|
|
2044
2053
|
<span>${liveTime}</span>
|
|
2045
2054
|
${this.giConfig.followerDisplay ? `
|
|
2046
2055
|
<span>
|
|
2047
|
-
${liveStatus === 1 ? `当前粉丝数:${
|
|
2056
|
+
${liveStatus === 1 ? `当前粉丝数:${liveData.fansNum || "暂未获取到"}` : liveStatus === 2 ? `${liveData.watchedNum !== "API" ? `累计观看人数:${liveData.watchedNum}` : ""}` : liveStatus === 3 ? `粉丝数变化:${liveData.fansChanged}` : ""}
|
|
2048
2057
|
</span>` : ""}
|
|
2049
2058
|
</p>
|
|
2050
2059
|
</div>
|
|
@@ -3344,8 +3353,8 @@ var GenerateImg$1 = class extends Service {
|
|
|
3344
3353
|
hideDesc: Schema.boolean(),
|
|
3345
3354
|
followerDisplay: Schema.boolean()
|
|
3346
3355
|
});
|
|
3347
|
-
})(GenerateImg
|
|
3348
|
-
var
|
|
3356
|
+
})(GenerateImg || (GenerateImg = {}));
|
|
3357
|
+
var generate_img_default = GenerateImg;
|
|
3349
3358
|
|
|
3350
3359
|
//#endregion
|
|
3351
3360
|
//#region src/bili_api.ts
|
|
@@ -3440,7 +3449,7 @@ const COPY_USER_TO_GROUP = "https://api.bilibili.com/x/relation/tags/copyUsers";
|
|
|
3440
3449
|
const GET_RELATION_GROUP_DETAIL = "https://api.bilibili.com/x/relation/tag";
|
|
3441
3450
|
const GET_LIVE_ROOM_INFO_STREAM_KEY = "https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo";
|
|
3442
3451
|
const GET_LIVE_ROOMS_INFO = "https://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids";
|
|
3443
|
-
var BiliAPI
|
|
3452
|
+
var BiliAPI = class extends Service {
|
|
3444
3453
|
static inject = ["database", "notifier"];
|
|
3445
3454
|
jar;
|
|
3446
3455
|
client;
|
|
@@ -4122,8 +4131,8 @@ var BiliAPI$1 = class extends Service {
|
|
|
4122
4131
|
userAgent: Schema.string(),
|
|
4123
4132
|
key: Schema.string().pattern(/^[0-9a-f]{32}$/).required()
|
|
4124
4133
|
});
|
|
4125
|
-
})(BiliAPI
|
|
4126
|
-
var
|
|
4134
|
+
})(BiliAPI || (BiliAPI = {}));
|
|
4135
|
+
var bili_api_default = BiliAPI;
|
|
4127
4136
|
|
|
4128
4137
|
//#endregion
|
|
4129
4138
|
//#region src/bili_live.ts
|
|
@@ -4156,6 +4165,7 @@ var BLive = class extends Service {
|
|
|
4156
4165
|
this.logger.warn(`${roomId}直播间连接未成功关闭`);
|
|
4157
4166
|
}
|
|
4158
4167
|
};
|
|
4168
|
+
var bili_live_default = BLive;
|
|
4159
4169
|
|
|
4160
4170
|
//#endregion
|
|
4161
4171
|
//#region src/index.ts
|
|
@@ -4197,11 +4207,11 @@ var ServerManager = class extends Service {
|
|
|
4197
4207
|
registerPlugin = () => {
|
|
4198
4208
|
if (this.servers.length !== 0) return false;
|
|
4199
4209
|
try {
|
|
4200
|
-
const ba = this.ctx.plugin(
|
|
4210
|
+
const ba = this.ctx.plugin(bili_api_default, {
|
|
4201
4211
|
userAgent: globalConfig.userAgent,
|
|
4202
4212
|
key: globalConfig.key
|
|
4203
4213
|
});
|
|
4204
|
-
const gi = this.ctx.plugin(
|
|
4214
|
+
const gi = this.ctx.plugin(generate_img_default, {
|
|
4205
4215
|
filter: globalConfig.filter,
|
|
4206
4216
|
removeBorder: globalConfig.removeBorder,
|
|
4207
4217
|
cardColorStart: globalConfig.cardColorStart,
|
|
@@ -4213,7 +4223,7 @@ var ServerManager = class extends Service {
|
|
|
4213
4223
|
font: globalConfig.font,
|
|
4214
4224
|
followerDisplay: globalConfig.followerDisplay
|
|
4215
4225
|
});
|
|
4216
|
-
const cr = this.ctx.plugin(
|
|
4226
|
+
const cr = this.ctx.plugin(command_register_default, {
|
|
4217
4227
|
advancedSub: globalConfig.advancedSub,
|
|
4218
4228
|
subs: globalConfig.subs,
|
|
4219
4229
|
master: globalConfig.master,
|
|
@@ -4232,7 +4242,7 @@ var ServerManager = class extends Service {
|
|
|
4232
4242
|
filter: globalConfig.filter,
|
|
4233
4243
|
dynamicDebugMode: globalConfig.dynamicDebugMode
|
|
4234
4244
|
});
|
|
4235
|
-
const bl = this.ctx.plugin(
|
|
4245
|
+
const bl = this.ctx.plugin(bili_live_default);
|
|
4236
4246
|
this.servers.push(ba);
|
|
4237
4247
|
this.servers.push(bl);
|
|
4238
4248
|
this.servers.push(gi);
|