koishi-plugin-bilibili-notify 3.2.9-alpha.4 → 3.2.9-rc.0
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.d.mts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +155 -12
- package/lib/index.mjs +155 -12
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/index.d.mts
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -112,6 +112,7 @@ const BAConfigSchema = koishi.Schema.object({
|
|
|
112
112
|
pushImgsInDynamic: koishi.Schema.boolean().default(false).description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
|
|
113
113
|
live: koishi.Schema.object({}).description("直播推送设置"),
|
|
114
114
|
liveDetectType: koishi.Schema.union([koishi.Schema.const("WS").description("使用WebSocket连接到B站消息服务器进行直播检测,推荐使用"), koishi.Schema.const("API").description("通过轮询API发送请求监测直播状态,此模式理论可无限订阅,但容易产生其他问题,功能没有WS模式全面").experimental()]).role("radio").default("WS").description("直播检测方式,WS为连接到B站消息服务器,API为通过轮询发送请求监测,默认使用WS检测"),
|
|
115
|
+
wordcloud: koishi.Schema.boolean().default(false).description("直播结束后,是否生成本场直播弹幕词云"),
|
|
115
116
|
restartPush: koishi.Schema.boolean().default(true).description("插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启"),
|
|
116
117
|
pushTime: koishi.Schema.number().min(0).max(12).step(.5).default(1).description("设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时"),
|
|
117
118
|
customLiveStart: koishi.Schema.string().default("-name开播啦,当前粉丝数:-follower\\n-link").description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name开播啦,会发送为xxxUP开播啦"),
|
|
@@ -847,7 +848,147 @@ var ComRegister = class {
|
|
|
847
848
|
["b8n5c", 70],
|
|
848
849
|
["v3x7w", 163],
|
|
849
850
|
["t6c4a", 49],
|
|
850
|
-
["z9u2j", 146]
|
|
851
|
+
["z9u2j", 146],
|
|
852
|
+
["k1q8z", 102],
|
|
853
|
+
["v7n2a", 31],
|
|
854
|
+
["b4x9p", 176],
|
|
855
|
+
["w2m5s", 61],
|
|
856
|
+
["t8j3u", 150],
|
|
857
|
+
["z5c7l", 84],
|
|
858
|
+
["h2r8y", 196],
|
|
859
|
+
["n9d1q", 44],
|
|
860
|
+
["p6s3e", 123],
|
|
861
|
+
["f8g2b", 17],
|
|
862
|
+
["m1v7k", 109],
|
|
863
|
+
["x4a9w", 72],
|
|
864
|
+
["c7t2z", 180],
|
|
865
|
+
["u5b8n", 38],
|
|
866
|
+
["e1y3h", 134],
|
|
867
|
+
["j8l6p", 56],
|
|
868
|
+
["s2q9d", 191],
|
|
869
|
+
["g7m4x", 25],
|
|
870
|
+
["a5w8c", 113],
|
|
871
|
+
["l9h2v", 68],
|
|
872
|
+
["y1k7t", 159],
|
|
873
|
+
["d8z3u", 45],
|
|
874
|
+
["q2e6j", 177],
|
|
875
|
+
["r7p1s", 80],
|
|
876
|
+
["b5n9f", 126],
|
|
877
|
+
["v1x4m", 32],
|
|
878
|
+
["t7c8w", 198],
|
|
879
|
+
["z4u2h", 54],
|
|
880
|
+
["h9y5j", 143],
|
|
881
|
+
["n2l7s", 19],
|
|
882
|
+
["p8d1g", 104],
|
|
883
|
+
["f5b3a", 67],
|
|
884
|
+
["m2v9x", 171],
|
|
885
|
+
["x8a4c", 40],
|
|
886
|
+
["c1t7u", 187],
|
|
887
|
+
["u4b2e", 28],
|
|
888
|
+
["e9y6k", 135],
|
|
889
|
+
["j2l8q", 60],
|
|
890
|
+
["s7g1m", 119],
|
|
891
|
+
["g4w5t", 76],
|
|
892
|
+
["a9z2h", 164],
|
|
893
|
+
["l1h7p", 35],
|
|
894
|
+
["y8k3n", 185],
|
|
895
|
+
["d2u9f", 22],
|
|
896
|
+
["q7e4v", 110],
|
|
897
|
+
["r5p8x", 69],
|
|
898
|
+
["b1n6c", 152],
|
|
899
|
+
["v8x2w", 48],
|
|
900
|
+
["t4c7a", 142],
|
|
901
|
+
["z7u1j", 99],
|
|
902
|
+
["k2q5z", 174],
|
|
903
|
+
["v9n8a", 37],
|
|
904
|
+
["b6x3p", 189],
|
|
905
|
+
["w1m7s", 24],
|
|
906
|
+
["t5j2u", 115],
|
|
907
|
+
["z1c8l", 63],
|
|
908
|
+
["h6r4y", 155],
|
|
909
|
+
["n3d9q", 50],
|
|
910
|
+
["p7s2e", 137],
|
|
911
|
+
["f9g1b", 81],
|
|
912
|
+
["m4v6k", 170],
|
|
913
|
+
["x1a8w", 42],
|
|
914
|
+
["c8t3z", 194],
|
|
915
|
+
["u2b7n", 26],
|
|
916
|
+
["e5y9h", 130],
|
|
917
|
+
["j9l1p", 58],
|
|
918
|
+
["s4q6d", 182],
|
|
919
|
+
["g1m8x", 33],
|
|
920
|
+
["a8w5c", 108],
|
|
921
|
+
["l3h9v", 75],
|
|
922
|
+
["y2k4t", 161],
|
|
923
|
+
["d9z1u", 46],
|
|
924
|
+
["q5e8j", 149],
|
|
925
|
+
["r2p7s", 20],
|
|
926
|
+
["b9n3f", 122],
|
|
927
|
+
["v4x6m", 65],
|
|
928
|
+
["t1c9w", 179],
|
|
929
|
+
["z8u5h", 30],
|
|
930
|
+
["h3y2j", 136],
|
|
931
|
+
["n5l8s", 52],
|
|
932
|
+
["p1d4g", 167],
|
|
933
|
+
["f6b9a", 95],
|
|
934
|
+
["m3v2x", 156],
|
|
935
|
+
["x9a5c", 43],
|
|
936
|
+
["c2t8u", 192],
|
|
937
|
+
["u7b1e", 16],
|
|
938
|
+
["e4y6k", 129],
|
|
939
|
+
["j5l3q", 78],
|
|
940
|
+
["s1g9m", 118],
|
|
941
|
+
["g8w2t", 71],
|
|
942
|
+
["a3z7h", 173],
|
|
943
|
+
["l6h1p", 36],
|
|
944
|
+
["y9k5n", 184],
|
|
945
|
+
["d1u8f", 15],
|
|
946
|
+
["q8e3v", 111],
|
|
947
|
+
["r4p6x", 64],
|
|
948
|
+
["b2n7c", 151],
|
|
949
|
+
["v5x1w", 47],
|
|
950
|
+
["t8c4a", 140],
|
|
951
|
+
["z3u9j", 98],
|
|
952
|
+
["k7q2z", 176],
|
|
953
|
+
["v1n5a", 55],
|
|
954
|
+
["b8x6p", 195],
|
|
955
|
+
["w3m1s", 14],
|
|
956
|
+
["t6j9u", 116],
|
|
957
|
+
["z2c5l", 61],
|
|
958
|
+
["h7r3y", 153],
|
|
959
|
+
["n4d8q", 51],
|
|
960
|
+
["p2s7e", 139],
|
|
961
|
+
["f7g5b", 82],
|
|
962
|
+
["m9v1k", 169],
|
|
963
|
+
["x5a3w", 38],
|
|
964
|
+
["c9t6z", 197],
|
|
965
|
+
["u3b8n", 17],
|
|
966
|
+
["e6y2h", 131],
|
|
967
|
+
["j7l5p", 59],
|
|
968
|
+
["s3q8d", 181],
|
|
969
|
+
["g2m4x", 34],
|
|
970
|
+
["a6w9c", 107],
|
|
971
|
+
["l8h2v", 74],
|
|
972
|
+
["y4k7t", 162],
|
|
973
|
+
["d6z5u", 49],
|
|
974
|
+
["q3e1j", 148],
|
|
975
|
+
["r9p2s", 21],
|
|
976
|
+
["b4n8f", 121],
|
|
977
|
+
["v7x5m", 68],
|
|
978
|
+
["t2c1w", 178],
|
|
979
|
+
["z5u3h", 31],
|
|
980
|
+
["h8y6j", 133],
|
|
981
|
+
["n1l4s", 57],
|
|
982
|
+
["p5d7g", 166],
|
|
983
|
+
["f3b2a", 96],
|
|
984
|
+
["m6v8x", 158],
|
|
985
|
+
["x2a9c", 45],
|
|
986
|
+
["c5t1u", 191],
|
|
987
|
+
["u8b4e", 19],
|
|
988
|
+
["e3y7k", 128],
|
|
989
|
+
["j6l2q", 79],
|
|
990
|
+
["s9g5m", 114],
|
|
991
|
+
["g5w3t", 73]
|
|
851
992
|
];
|
|
852
993
|
await session.send(/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(await this.ctx.gi.generateWordCloudImg(words, "词云测试"), "image/jpg") }));
|
|
853
994
|
});
|
|
@@ -1295,12 +1436,12 @@ var ComRegister = class {
|
|
|
1295
1436
|
const liveMsgObj = this.liveMsgManager.get(uid);
|
|
1296
1437
|
const sendDanmakuWordCloud = async () => {
|
|
1297
1438
|
this.logger.info("开始制作弹幕词云");
|
|
1298
|
-
this.logger.info("正在获取前
|
|
1299
|
-
const
|
|
1300
|
-
this.logger.info("弹幕词云前
|
|
1301
|
-
this.logger.info(
|
|
1439
|
+
this.logger.info("正在获取前150热词");
|
|
1440
|
+
const top150Words = Object.entries(danmakuWeightRecord).sort((a$1, b$2) => b$2[1] - a$1[1]).slice(0, 150);
|
|
1441
|
+
this.logger.info("弹幕词云前150词及权重:");
|
|
1442
|
+
this.logger.info(top150Words);
|
|
1302
1443
|
this.logger.info("正在准备生成弹幕词云");
|
|
1303
|
-
const buffer = await this.ctx.gi.generateWordCloudImg(
|
|
1444
|
+
const buffer = await this.ctx.gi.generateWordCloudImg(top150Words, masterInfo.username);
|
|
1304
1445
|
this.logger.info("弹幕词云生成完成,正在准备发送词云图片");
|
|
1305
1446
|
await this.broadcastToTargets(uid, koishi.h.image(buffer, "image/jpeg"), PushType.Live);
|
|
1306
1447
|
};
|
|
@@ -1385,7 +1526,7 @@ var ComRegister = class {
|
|
|
1385
1526
|
masterInfo,
|
|
1386
1527
|
cardStyle
|
|
1387
1528
|
}, uid, liveStartMsg);
|
|
1388
|
-
if (!pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
|
|
1529
|
+
if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
|
|
1389
1530
|
},
|
|
1390
1531
|
onLiveEnd: async () => {
|
|
1391
1532
|
liveStatus = false;
|
|
@@ -1407,7 +1548,7 @@ var ComRegister = class {
|
|
|
1407
1548
|
}, uid, liveEndMsg);
|
|
1408
1549
|
pushAtTimeTimer();
|
|
1409
1550
|
pushAtTimeTimer = null;
|
|
1410
|
-
await sendDanmakuWordCloud();
|
|
1551
|
+
if (this.config.wordcloud) await sendDanmakuWordCloud();
|
|
1411
1552
|
}
|
|
1412
1553
|
};
|
|
1413
1554
|
await this.ctx.bl.startLiveRoomListener(roomId, handler);
|
|
@@ -1421,7 +1562,7 @@ var ComRegister = class {
|
|
|
1421
1562
|
masterInfo,
|
|
1422
1563
|
cardStyle
|
|
1423
1564
|
}, uid, liveMsg);
|
|
1424
|
-
if (!pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
|
|
1565
|
+
if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
|
|
1425
1566
|
liveStatus = true;
|
|
1426
1567
|
}
|
|
1427
1568
|
}
|
|
@@ -1827,6 +1968,7 @@ var ComRegister = class {
|
|
|
1827
1968
|
masterAccountGuildId: koishi.Schema.string()
|
|
1828
1969
|
}),
|
|
1829
1970
|
liveDetectType: koishi.Schema.string(),
|
|
1971
|
+
wordcloud: koishi.Schema.boolean(),
|
|
1830
1972
|
restartPush: koishi.Schema.boolean().required(),
|
|
1831
1973
|
pushTime: koishi.Schema.number().required(),
|
|
1832
1974
|
pushImgsInDynamic: koishi.Schema.boolean().required(),
|
|
@@ -94486,19 +94628,19 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94486
94628
|
const minWeight = Math.min(...words.map(w => w[1]));
|
|
94487
94629
|
|
|
94488
94630
|
// 设置最大字体大小、最小字体大小(以像素为单位)
|
|
94489
|
-
const maxFontSize =
|
|
94631
|
+
const maxFontSize = 80;
|
|
94490
94632
|
const minFontSize = 14;
|
|
94491
94633
|
|
|
94492
94634
|
// 用映射函数代替 weightFactor
|
|
94493
94635
|
function getWeightFactor(size) {
|
|
94494
94636
|
if (maxWeight === minWeight) return maxFontSize; // 防止除0
|
|
94495
94637
|
const ratio = (size - minWeight) / (maxWeight - minWeight);
|
|
94496
|
-
return minFontSize + (maxFontSize - minFontSize) * ratio;
|
|
94638
|
+
return minFontSize + (maxFontSize - minFontSize) * Math.pow(ratio, 0.85);
|
|
94497
94639
|
}
|
|
94498
94640
|
|
|
94499
94641
|
WordCloud(canvas, {
|
|
94500
94642
|
list: words,
|
|
94501
|
-
gridSize: Math.round(
|
|
94643
|
+
gridSize: Math.max(4, Math.round(5 * (cssWidth / 1024))),
|
|
94502
94644
|
weightFactor: getWeightFactor,
|
|
94503
94645
|
fontFamily: 'Quicksand, sans-serif',
|
|
94504
94646
|
color: () => {
|
|
@@ -95415,6 +95557,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
95415
95557
|
const cr = this.ctx.plugin(comRegister_default, {
|
|
95416
95558
|
sub: globalConfig.sub,
|
|
95417
95559
|
master: globalConfig.master,
|
|
95560
|
+
wordcloud: globalConfig.wordcloud,
|
|
95418
95561
|
liveDetectType: globalConfig.liveDetectType,
|
|
95419
95562
|
restartPush: globalConfig.restartPush,
|
|
95420
95563
|
pushTime: globalConfig.pushTime,
|
package/lib/index.mjs
CHANGED
|
@@ -114,6 +114,7 @@ const BAConfigSchema = Schema.object({
|
|
|
114
114
|
pushImgsInDynamic: Schema.boolean().default(false).description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
|
|
115
115
|
live: Schema.object({}).description("直播推送设置"),
|
|
116
116
|
liveDetectType: Schema.union([Schema.const("WS").description("使用WebSocket连接到B站消息服务器进行直播检测,推荐使用"), Schema.const("API").description("通过轮询API发送请求监测直播状态,此模式理论可无限订阅,但容易产生其他问题,功能没有WS模式全面").experimental()]).role("radio").default("WS").description("直播检测方式,WS为连接到B站消息服务器,API为通过轮询发送请求监测,默认使用WS检测"),
|
|
117
|
+
wordcloud: Schema.boolean().default(false).description("直播结束后,是否生成本场直播弹幕词云"),
|
|
117
118
|
restartPush: Schema.boolean().default(true).description("插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启"),
|
|
118
119
|
pushTime: Schema.number().min(0).max(12).step(.5).default(1).description("设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时"),
|
|
119
120
|
customLiveStart: Schema.string().default("-name开播啦,当前粉丝数:-follower\\n-link").description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name开播啦,会发送为xxxUP开播啦"),
|
|
@@ -849,7 +850,147 @@ var ComRegister = class {
|
|
|
849
850
|
["b8n5c", 70],
|
|
850
851
|
["v3x7w", 163],
|
|
851
852
|
["t6c4a", 49],
|
|
852
|
-
["z9u2j", 146]
|
|
853
|
+
["z9u2j", 146],
|
|
854
|
+
["k1q8z", 102],
|
|
855
|
+
["v7n2a", 31],
|
|
856
|
+
["b4x9p", 176],
|
|
857
|
+
["w2m5s", 61],
|
|
858
|
+
["t8j3u", 150],
|
|
859
|
+
["z5c7l", 84],
|
|
860
|
+
["h2r8y", 196],
|
|
861
|
+
["n9d1q", 44],
|
|
862
|
+
["p6s3e", 123],
|
|
863
|
+
["f8g2b", 17],
|
|
864
|
+
["m1v7k", 109],
|
|
865
|
+
["x4a9w", 72],
|
|
866
|
+
["c7t2z", 180],
|
|
867
|
+
["u5b8n", 38],
|
|
868
|
+
["e1y3h", 134],
|
|
869
|
+
["j8l6p", 56],
|
|
870
|
+
["s2q9d", 191],
|
|
871
|
+
["g7m4x", 25],
|
|
872
|
+
["a5w8c", 113],
|
|
873
|
+
["l9h2v", 68],
|
|
874
|
+
["y1k7t", 159],
|
|
875
|
+
["d8z3u", 45],
|
|
876
|
+
["q2e6j", 177],
|
|
877
|
+
["r7p1s", 80],
|
|
878
|
+
["b5n9f", 126],
|
|
879
|
+
["v1x4m", 32],
|
|
880
|
+
["t7c8w", 198],
|
|
881
|
+
["z4u2h", 54],
|
|
882
|
+
["h9y5j", 143],
|
|
883
|
+
["n2l7s", 19],
|
|
884
|
+
["p8d1g", 104],
|
|
885
|
+
["f5b3a", 67],
|
|
886
|
+
["m2v9x", 171],
|
|
887
|
+
["x8a4c", 40],
|
|
888
|
+
["c1t7u", 187],
|
|
889
|
+
["u4b2e", 28],
|
|
890
|
+
["e9y6k", 135],
|
|
891
|
+
["j2l8q", 60],
|
|
892
|
+
["s7g1m", 119],
|
|
893
|
+
["g4w5t", 76],
|
|
894
|
+
["a9z2h", 164],
|
|
895
|
+
["l1h7p", 35],
|
|
896
|
+
["y8k3n", 185],
|
|
897
|
+
["d2u9f", 22],
|
|
898
|
+
["q7e4v", 110],
|
|
899
|
+
["r5p8x", 69],
|
|
900
|
+
["b1n6c", 152],
|
|
901
|
+
["v8x2w", 48],
|
|
902
|
+
["t4c7a", 142],
|
|
903
|
+
["z7u1j", 99],
|
|
904
|
+
["k2q5z", 174],
|
|
905
|
+
["v9n8a", 37],
|
|
906
|
+
["b6x3p", 189],
|
|
907
|
+
["w1m7s", 24],
|
|
908
|
+
["t5j2u", 115],
|
|
909
|
+
["z1c8l", 63],
|
|
910
|
+
["h6r4y", 155],
|
|
911
|
+
["n3d9q", 50],
|
|
912
|
+
["p7s2e", 137],
|
|
913
|
+
["f9g1b", 81],
|
|
914
|
+
["m4v6k", 170],
|
|
915
|
+
["x1a8w", 42],
|
|
916
|
+
["c8t3z", 194],
|
|
917
|
+
["u2b7n", 26],
|
|
918
|
+
["e5y9h", 130],
|
|
919
|
+
["j9l1p", 58],
|
|
920
|
+
["s4q6d", 182],
|
|
921
|
+
["g1m8x", 33],
|
|
922
|
+
["a8w5c", 108],
|
|
923
|
+
["l3h9v", 75],
|
|
924
|
+
["y2k4t", 161],
|
|
925
|
+
["d9z1u", 46],
|
|
926
|
+
["q5e8j", 149],
|
|
927
|
+
["r2p7s", 20],
|
|
928
|
+
["b9n3f", 122],
|
|
929
|
+
["v4x6m", 65],
|
|
930
|
+
["t1c9w", 179],
|
|
931
|
+
["z8u5h", 30],
|
|
932
|
+
["h3y2j", 136],
|
|
933
|
+
["n5l8s", 52],
|
|
934
|
+
["p1d4g", 167],
|
|
935
|
+
["f6b9a", 95],
|
|
936
|
+
["m3v2x", 156],
|
|
937
|
+
["x9a5c", 43],
|
|
938
|
+
["c2t8u", 192],
|
|
939
|
+
["u7b1e", 16],
|
|
940
|
+
["e4y6k", 129],
|
|
941
|
+
["j5l3q", 78],
|
|
942
|
+
["s1g9m", 118],
|
|
943
|
+
["g8w2t", 71],
|
|
944
|
+
["a3z7h", 173],
|
|
945
|
+
["l6h1p", 36],
|
|
946
|
+
["y9k5n", 184],
|
|
947
|
+
["d1u8f", 15],
|
|
948
|
+
["q8e3v", 111],
|
|
949
|
+
["r4p6x", 64],
|
|
950
|
+
["b2n7c", 151],
|
|
951
|
+
["v5x1w", 47],
|
|
952
|
+
["t8c4a", 140],
|
|
953
|
+
["z3u9j", 98],
|
|
954
|
+
["k7q2z", 176],
|
|
955
|
+
["v1n5a", 55],
|
|
956
|
+
["b8x6p", 195],
|
|
957
|
+
["w3m1s", 14],
|
|
958
|
+
["t6j9u", 116],
|
|
959
|
+
["z2c5l", 61],
|
|
960
|
+
["h7r3y", 153],
|
|
961
|
+
["n4d8q", 51],
|
|
962
|
+
["p2s7e", 139],
|
|
963
|
+
["f7g5b", 82],
|
|
964
|
+
["m9v1k", 169],
|
|
965
|
+
["x5a3w", 38],
|
|
966
|
+
["c9t6z", 197],
|
|
967
|
+
["u3b8n", 17],
|
|
968
|
+
["e6y2h", 131],
|
|
969
|
+
["j7l5p", 59],
|
|
970
|
+
["s3q8d", 181],
|
|
971
|
+
["g2m4x", 34],
|
|
972
|
+
["a6w9c", 107],
|
|
973
|
+
["l8h2v", 74],
|
|
974
|
+
["y4k7t", 162],
|
|
975
|
+
["d6z5u", 49],
|
|
976
|
+
["q3e1j", 148],
|
|
977
|
+
["r9p2s", 21],
|
|
978
|
+
["b4n8f", 121],
|
|
979
|
+
["v7x5m", 68],
|
|
980
|
+
["t2c1w", 178],
|
|
981
|
+
["z5u3h", 31],
|
|
982
|
+
["h8y6j", 133],
|
|
983
|
+
["n1l4s", 57],
|
|
984
|
+
["p5d7g", 166],
|
|
985
|
+
["f3b2a", 96],
|
|
986
|
+
["m6v8x", 158],
|
|
987
|
+
["x2a9c", 45],
|
|
988
|
+
["c5t1u", 191],
|
|
989
|
+
["u8b4e", 19],
|
|
990
|
+
["e3y7k", 128],
|
|
991
|
+
["j6l2q", 79],
|
|
992
|
+
["s9g5m", 114],
|
|
993
|
+
["g5w3t", 73]
|
|
853
994
|
];
|
|
854
995
|
await session.send(/* @__PURE__ */ jsx("message", { children: h.image(await this.ctx.gi.generateWordCloudImg(words, "词云测试"), "image/jpg") }));
|
|
855
996
|
});
|
|
@@ -1297,12 +1438,12 @@ var ComRegister = class {
|
|
|
1297
1438
|
const liveMsgObj = this.liveMsgManager.get(uid);
|
|
1298
1439
|
const sendDanmakuWordCloud = async () => {
|
|
1299
1440
|
this.logger.info("开始制作弹幕词云");
|
|
1300
|
-
this.logger.info("正在获取前
|
|
1301
|
-
const
|
|
1302
|
-
this.logger.info("弹幕词云前
|
|
1303
|
-
this.logger.info(
|
|
1441
|
+
this.logger.info("正在获取前150热词");
|
|
1442
|
+
const top150Words = Object.entries(danmakuWeightRecord).sort((a$1, b$2) => b$2[1] - a$1[1]).slice(0, 150);
|
|
1443
|
+
this.logger.info("弹幕词云前150词及权重:");
|
|
1444
|
+
this.logger.info(top150Words);
|
|
1304
1445
|
this.logger.info("正在准备生成弹幕词云");
|
|
1305
|
-
const buffer = await this.ctx.gi.generateWordCloudImg(
|
|
1446
|
+
const buffer = await this.ctx.gi.generateWordCloudImg(top150Words, masterInfo.username);
|
|
1306
1447
|
this.logger.info("弹幕词云生成完成,正在准备发送词云图片");
|
|
1307
1448
|
await this.broadcastToTargets(uid, h.image(buffer, "image/jpeg"), PushType.Live);
|
|
1308
1449
|
};
|
|
@@ -1387,7 +1528,7 @@ var ComRegister = class {
|
|
|
1387
1528
|
masterInfo,
|
|
1388
1529
|
cardStyle
|
|
1389
1530
|
}, uid, liveStartMsg);
|
|
1390
|
-
if (!pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
|
|
1531
|
+
if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
|
|
1391
1532
|
},
|
|
1392
1533
|
onLiveEnd: async () => {
|
|
1393
1534
|
liveStatus = false;
|
|
@@ -1409,7 +1550,7 @@ var ComRegister = class {
|
|
|
1409
1550
|
}, uid, liveEndMsg);
|
|
1410
1551
|
pushAtTimeTimer();
|
|
1411
1552
|
pushAtTimeTimer = null;
|
|
1412
|
-
await sendDanmakuWordCloud();
|
|
1553
|
+
if (this.config.wordcloud) await sendDanmakuWordCloud();
|
|
1413
1554
|
}
|
|
1414
1555
|
};
|
|
1415
1556
|
await this.ctx.bl.startLiveRoomListener(roomId, handler);
|
|
@@ -1423,7 +1564,7 @@ var ComRegister = class {
|
|
|
1423
1564
|
masterInfo,
|
|
1424
1565
|
cardStyle
|
|
1425
1566
|
}, uid, liveMsg);
|
|
1426
|
-
if (!pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
|
|
1567
|
+
if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
|
|
1427
1568
|
liveStatus = true;
|
|
1428
1569
|
}
|
|
1429
1570
|
}
|
|
@@ -1829,6 +1970,7 @@ var ComRegister = class {
|
|
|
1829
1970
|
masterAccountGuildId: Schema.string()
|
|
1830
1971
|
}),
|
|
1831
1972
|
liveDetectType: Schema.string(),
|
|
1973
|
+
wordcloud: Schema.boolean(),
|
|
1832
1974
|
restartPush: Schema.boolean().required(),
|
|
1833
1975
|
pushTime: Schema.number().required(),
|
|
1834
1976
|
pushImgsInDynamic: Schema.boolean().required(),
|
|
@@ -94488,19 +94630,19 @@ var GenerateImg = class extends Service {
|
|
|
94488
94630
|
const minWeight = Math.min(...words.map(w => w[1]));
|
|
94489
94631
|
|
|
94490
94632
|
// 设置最大字体大小、最小字体大小(以像素为单位)
|
|
94491
|
-
const maxFontSize =
|
|
94633
|
+
const maxFontSize = 80;
|
|
94492
94634
|
const minFontSize = 14;
|
|
94493
94635
|
|
|
94494
94636
|
// 用映射函数代替 weightFactor
|
|
94495
94637
|
function getWeightFactor(size) {
|
|
94496
94638
|
if (maxWeight === minWeight) return maxFontSize; // 防止除0
|
|
94497
94639
|
const ratio = (size - minWeight) / (maxWeight - minWeight);
|
|
94498
|
-
return minFontSize + (maxFontSize - minFontSize) * ratio;
|
|
94640
|
+
return minFontSize + (maxFontSize - minFontSize) * Math.pow(ratio, 0.85);
|
|
94499
94641
|
}
|
|
94500
94642
|
|
|
94501
94643
|
WordCloud(canvas, {
|
|
94502
94644
|
list: words,
|
|
94503
|
-
gridSize: Math.round(
|
|
94645
|
+
gridSize: Math.max(4, Math.round(5 * (cssWidth / 1024))),
|
|
94504
94646
|
weightFactor: getWeightFactor,
|
|
94505
94647
|
fontFamily: 'Quicksand, sans-serif',
|
|
94506
94648
|
color: () => {
|
|
@@ -95417,6 +95559,7 @@ var ServerManager = class extends Service {
|
|
|
95417
95559
|
const cr = this.ctx.plugin(comRegister_default, {
|
|
95418
95560
|
sub: globalConfig.sub,
|
|
95419
95561
|
master: globalConfig.master,
|
|
95562
|
+
wordcloud: globalConfig.wordcloud,
|
|
95420
95563
|
liveDetectType: globalConfig.liveDetectType,
|
|
95421
95564
|
restartPush: globalConfig.restartPush,
|
|
95422
95565
|
pushTime: globalConfig.pushTime,
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -305,6 +305,7 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
|
|
|
305
305
|
> - ver 3.2.9-alpha.2 修复:`AxiosError: Request failed with status code 404 xxx at async BiliAPI.checkIfTokenNeedRefresh`、潜在cookie相关bug、弹幕词云bug `Error: 生成图片失败!错误: TimeoutError: Navigation timeout of 30000 ms exceeded`
|
|
306
306
|
> - ver 3.2.9-alpha.3 修复:词云生成空白
|
|
307
307
|
> - ver 3.2.9-alpha.4 修复:弹幕词云bug `Error: 生成图片失败!错误: TimeoutError: Navigation timeout of 30000 ms exceeded`
|
|
308
|
+
> - ver 3.2.9-rc.0 优化:弹幕词云生成效果、选项 `pushTime` 设置为0时可关闭该功能; 新增:选项 `wordcloud` 可选择在直播结束后是否生成弹幕词云
|
|
308
309
|
|
|
309
310
|
## 交流群
|
|
310
311
|
|