koishi-plugin-bilibili-notify 3.2.9-rc.0 → 3.2.9-rc.2
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 +220 -250
- package/lib/index.mjs +220 -250
- package/lib/static/render.js +107 -0
- package/package.json +2 -2
- package/readme.md +4 -5
package/lib/index.js
CHANGED
|
@@ -39,7 +39,8 @@ const path = __toESM$1(require("path"));
|
|
|
39
39
|
const qrcode = __toESM$1(require("qrcode"));
|
|
40
40
|
const cron = __toESM$1(require("cron"));
|
|
41
41
|
const luxon = __toESM$1(require("luxon"));
|
|
42
|
-
const
|
|
42
|
+
const __node_rs_jieba = __toESM$1(require("@node-rs/jieba"));
|
|
43
|
+
const __node_rs_jieba_dict = __toESM$1(require("@node-rs/jieba/dict"));
|
|
43
44
|
const __satorijs_element_jsx_runtime = __toESM$1(require("@satorijs/element/jsx-runtime"));
|
|
44
45
|
const node_path = __toESM$1(require("node:path"));
|
|
45
46
|
const node_url = __toESM$1(require("node:url"));
|
|
@@ -615,7 +616,142 @@ const PushTypeMsg = {
|
|
|
615
616
|
};
|
|
616
617
|
|
|
617
618
|
//#endregion
|
|
618
|
-
//#region src/
|
|
619
|
+
//#region src/stop_words.ts
|
|
620
|
+
const stopwords = new Set([
|
|
621
|
+
",",
|
|
622
|
+
"。",
|
|
623
|
+
"!",
|
|
624
|
+
"?",
|
|
625
|
+
":",
|
|
626
|
+
";",
|
|
627
|
+
"“",
|
|
628
|
+
"”",
|
|
629
|
+
"‘",
|
|
630
|
+
"’",
|
|
631
|
+
"(",
|
|
632
|
+
")",
|
|
633
|
+
"、",
|
|
634
|
+
"……",
|
|
635
|
+
"——",
|
|
636
|
+
"-",
|
|
637
|
+
"_",
|
|
638
|
+
".",
|
|
639
|
+
",",
|
|
640
|
+
"(",
|
|
641
|
+
")",
|
|
642
|
+
"【",
|
|
643
|
+
"】",
|
|
644
|
+
"而且",
|
|
645
|
+
"但是",
|
|
646
|
+
"如果",
|
|
647
|
+
"虽然",
|
|
648
|
+
"因为",
|
|
649
|
+
"所以",
|
|
650
|
+
"但是",
|
|
651
|
+
"那么",
|
|
652
|
+
"那么就",
|
|
653
|
+
"今天",
|
|
654
|
+
"昨天",
|
|
655
|
+
"后天",
|
|
656
|
+
"明天",
|
|
657
|
+
"现在",
|
|
658
|
+
"刚刚",
|
|
659
|
+
"刚才",
|
|
660
|
+
"一直",
|
|
661
|
+
"一直在",
|
|
662
|
+
"目前",
|
|
663
|
+
"以前",
|
|
664
|
+
"以后",
|
|
665
|
+
"以前的",
|
|
666
|
+
"the",
|
|
667
|
+
"and",
|
|
668
|
+
"to",
|
|
669
|
+
"of",
|
|
670
|
+
"a",
|
|
671
|
+
"is",
|
|
672
|
+
"in",
|
|
673
|
+
"on",
|
|
674
|
+
"for",
|
|
675
|
+
"with",
|
|
676
|
+
"this",
|
|
677
|
+
"that",
|
|
678
|
+
"you",
|
|
679
|
+
"觉得",
|
|
680
|
+
"表示",
|
|
681
|
+
"发现",
|
|
682
|
+
"认为",
|
|
683
|
+
"看到",
|
|
684
|
+
"听说",
|
|
685
|
+
"了解",
|
|
686
|
+
"知道",
|
|
687
|
+
"说明",
|
|
688
|
+
"指出",
|
|
689
|
+
"讨论",
|
|
690
|
+
"讨论一下",
|
|
691
|
+
"看看",
|
|
692
|
+
"想想",
|
|
693
|
+
"说说",
|
|
694
|
+
"讲讲",
|
|
695
|
+
"一个",
|
|
696
|
+
"一些",
|
|
697
|
+
"这个",
|
|
698
|
+
"那个",
|
|
699
|
+
"每个",
|
|
700
|
+
"什么",
|
|
701
|
+
"东西",
|
|
702
|
+
"事情",
|
|
703
|
+
"这些",
|
|
704
|
+
"那些",
|
|
705
|
+
"这种",
|
|
706
|
+
"那种",
|
|
707
|
+
"怎么说",
|
|
708
|
+
"怎么会",
|
|
709
|
+
"怎么可能",
|
|
710
|
+
"不可能",
|
|
711
|
+
"有点像",
|
|
712
|
+
"真的很",
|
|
713
|
+
"特别是",
|
|
714
|
+
"有时候",
|
|
715
|
+
"每次都",
|
|
716
|
+
"一点点",
|
|
717
|
+
"哪里有",
|
|
718
|
+
"太离谱",
|
|
719
|
+
"太搞笑",
|
|
720
|
+
"太真实",
|
|
721
|
+
"为了",
|
|
722
|
+
"因为",
|
|
723
|
+
"所以",
|
|
724
|
+
"但是",
|
|
725
|
+
"而且",
|
|
726
|
+
"然后",
|
|
727
|
+
"如果",
|
|
728
|
+
"虽然",
|
|
729
|
+
"然而",
|
|
730
|
+
"不过",
|
|
731
|
+
"并且",
|
|
732
|
+
"即使",
|
|
733
|
+
"由于",
|
|
734
|
+
"那么",
|
|
735
|
+
"除非",
|
|
736
|
+
"比如",
|
|
737
|
+
"比如说",
|
|
738
|
+
"现在",
|
|
739
|
+
"刚刚",
|
|
740
|
+
"刚才",
|
|
741
|
+
"以前",
|
|
742
|
+
"以后",
|
|
743
|
+
"一直",
|
|
744
|
+
"从来",
|
|
745
|
+
"目前",
|
|
746
|
+
"最近",
|
|
747
|
+
"已经",
|
|
748
|
+
"后来",
|
|
749
|
+
"之前",
|
|
750
|
+
"某天"
|
|
751
|
+
]);
|
|
752
|
+
|
|
753
|
+
//#endregion
|
|
754
|
+
//#region src/command_register.tsx
|
|
619
755
|
var import_lib$1 = __toESM$1(require_lib$3());
|
|
620
756
|
var ComRegister = class {
|
|
621
757
|
static inject = [
|
|
@@ -648,7 +784,7 @@ var ComRegister = class {
|
|
|
648
784
|
privateBot;
|
|
649
785
|
dynamicJob;
|
|
650
786
|
liveJob;
|
|
651
|
-
|
|
787
|
+
_jieba = __node_rs_jieba.Jieba.withDict(__node_rs_jieba_dict.dict);
|
|
652
788
|
constructor(ctx, config) {
|
|
653
789
|
this.ctx = ctx;
|
|
654
790
|
this.init(config);
|
|
@@ -799,196 +935,56 @@ var ComRegister = class {
|
|
|
799
935
|
});
|
|
800
936
|
biliCom.subcommand(".wc").action(async ({ session }) => {
|
|
801
937
|
const words = [
|
|
802
|
-
["
|
|
803
|
-
["
|
|
804
|
-
["
|
|
805
|
-
["
|
|
806
|
-
["
|
|
807
|
-
["
|
|
808
|
-
["
|
|
809
|
-
["
|
|
810
|
-
["
|
|
811
|
-
["
|
|
812
|
-
["
|
|
813
|
-
["
|
|
814
|
-
["
|
|
815
|
-
["
|
|
816
|
-
["
|
|
817
|
-
["
|
|
818
|
-
["
|
|
819
|
-
["
|
|
820
|
-
["
|
|
821
|
-
["
|
|
822
|
-
["
|
|
823
|
-
["
|
|
824
|
-
["
|
|
825
|
-
["
|
|
826
|
-
["
|
|
827
|
-
["
|
|
828
|
-
["
|
|
829
|
-
["
|
|
830
|
-
["
|
|
831
|
-
["
|
|
832
|
-
["
|
|
833
|
-
["
|
|
834
|
-
["
|
|
835
|
-
["
|
|
836
|
-
["
|
|
837
|
-
["
|
|
838
|
-
["
|
|
839
|
-
["
|
|
840
|
-
["
|
|
841
|
-
["
|
|
842
|
-
["
|
|
843
|
-
["
|
|
844
|
-
["
|
|
845
|
-
["
|
|
846
|
-
["
|
|
847
|
-
["
|
|
848
|
-
["
|
|
849
|
-
["
|
|
850
|
-
["
|
|
851
|
-
["
|
|
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]
|
|
938
|
+
["弹幕护体", 77],
|
|
939
|
+
["笑死", 30],
|
|
940
|
+
["泪目", 45],
|
|
941
|
+
["加油", 70],
|
|
942
|
+
["???", 80],
|
|
943
|
+
["我可以", 66],
|
|
944
|
+
["无语", 55],
|
|
945
|
+
["梦开始的地方", 1],
|
|
946
|
+
["太真实了", 8],
|
|
947
|
+
["我哭死", 1],
|
|
948
|
+
["人呢", 2],
|
|
949
|
+
["有点意思", 4],
|
|
950
|
+
["妙啊", 4],
|
|
951
|
+
["这波啊", 11],
|
|
952
|
+
["懂了", 6],
|
|
953
|
+
["破防了", 65],
|
|
954
|
+
["蚌埠住了", 92],
|
|
955
|
+
["草", 100],
|
|
956
|
+
["针不戳", 68],
|
|
957
|
+
["yyds", 50],
|
|
958
|
+
["DNA动了", 58],
|
|
959
|
+
["猝不及防", 40],
|
|
960
|
+
["建议加精", 15],
|
|
961
|
+
["保护", 22],
|
|
962
|
+
["害怕", 18],
|
|
963
|
+
["就这?", 99],
|
|
964
|
+
["2333", 20],
|
|
965
|
+
["公开处刑", 35],
|
|
966
|
+
["血压上来了", 45],
|
|
967
|
+
["整不会了", 32],
|
|
968
|
+
["见证历史", 88],
|
|
969
|
+
["下次一定", 65],
|
|
970
|
+
["奥利给", 56],
|
|
971
|
+
["求更新", 18],
|
|
972
|
+
["真实", 20],
|
|
973
|
+
["好活当赏", 25],
|
|
974
|
+
["泪,冲了出来", 68],
|
|
975
|
+
["刻进DNA", 70],
|
|
976
|
+
["我直接好家伙", 55],
|
|
977
|
+
["夺笋啊", 40],
|
|
978
|
+
["歪歪滴艾斯", 1],
|
|
979
|
+
["典中典", 5],
|
|
980
|
+
["麻中麻", 3],
|
|
981
|
+
["绷不住了", 8],
|
|
982
|
+
["逆天", 95],
|
|
983
|
+
["寄", 65],
|
|
984
|
+
["孝", 20],
|
|
985
|
+
["乐", 101],
|
|
986
|
+
["急急急", 3],
|
|
987
|
+
["典", 5]
|
|
992
988
|
];
|
|
993
989
|
await session.send(/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(await this.ctx.gi.generateWordCloudImg(words, "词云测试"), "image/jpg") }));
|
|
994
990
|
});
|
|
@@ -1121,7 +1117,7 @@ var ComRegister = class {
|
|
|
1121
1117
|
}
|
|
1122
1118
|
async broadcastToTargets(uid, content, type, retry = 3e3) {
|
|
1123
1119
|
if (!this.checkAllBotsAreReady()) {
|
|
1124
|
-
this.logger.error(
|
|
1120
|
+
this.logger.error(`存在机器人未初始化完毕,无法进行推送,${retry / 1e3}秒后重试`);
|
|
1125
1121
|
this.ctx.setTimeout(() => {
|
|
1126
1122
|
this.broadcastToTargets(uid, content, type, retry * 2);
|
|
1127
1123
|
}, retry);
|
|
@@ -1136,7 +1132,7 @@ var ComRegister = class {
|
|
|
1136
1132
|
const success = await withRetry(async () => {
|
|
1137
1133
|
return await this.ctx.broadcast(atAllArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("at", { type: "all" }) }));
|
|
1138
1134
|
}, 1);
|
|
1139
|
-
this.logger.info(
|
|
1135
|
+
this.logger.info(`成功推送全体成员消息:${success.length}条`);
|
|
1140
1136
|
}
|
|
1141
1137
|
if (type === PushType.Dynamic && record.dynamicArr?.length >= 1) {
|
|
1142
1138
|
this.logger.info(record.dynamicArr);
|
|
@@ -1144,7 +1140,7 @@ var ComRegister = class {
|
|
|
1144
1140
|
const success = await withRetry(async () => {
|
|
1145
1141
|
return await this.ctx.broadcast(dynamicArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
|
|
1146
1142
|
}, 1);
|
|
1147
|
-
this.logger.info(
|
|
1143
|
+
this.logger.info(`成功推送动态消息:${success.length}条`);
|
|
1148
1144
|
}
|
|
1149
1145
|
if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length >= 1) {
|
|
1150
1146
|
this.logger.info(record.liveArr);
|
|
@@ -1152,7 +1148,7 @@ var ComRegister = class {
|
|
|
1152
1148
|
const success = await withRetry(async () => {
|
|
1153
1149
|
return await this.ctx.broadcast(liveArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
|
|
1154
1150
|
}, 1);
|
|
1155
|
-
this.logger.info(
|
|
1151
|
+
this.logger.info(`成功推送直播消息:${success.length}条`);
|
|
1156
1152
|
}
|
|
1157
1153
|
if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length >= 1) {
|
|
1158
1154
|
this.logger.info(record.liveGuardBuyArr);
|
|
@@ -1160,7 +1156,7 @@ var ComRegister = class {
|
|
|
1160
1156
|
const success = await withRetry(async () => {
|
|
1161
1157
|
return await this.ctx.broadcast(liveGuardBuyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
|
|
1162
1158
|
}, 1);
|
|
1163
|
-
this.logger.info(
|
|
1159
|
+
this.logger.info(`成功推送上舰消息:${success.length}条`);
|
|
1164
1160
|
}
|
|
1165
1161
|
return;
|
|
1166
1162
|
}
|
|
@@ -1420,8 +1416,7 @@ var ComRegister = class {
|
|
|
1420
1416
|
return await this.broadcastToTargets(uid, msg, liveType === LiveType.StartBroadcasting ? PushType.StartBroadcasting : PushType.Live);
|
|
1421
1417
|
}
|
|
1422
1418
|
async segmentDanmaku(danmaku, danmakuWeightRecord) {
|
|
1423
|
-
this.
|
|
1424
|
-
if (p$1 && p$1 === 2048) return;
|
|
1419
|
+
this._jieba.cut(danmaku, true).filter((word) => word.length >= 2 && !stopwords.has(word)).map((w$3) => {
|
|
1425
1420
|
danmakuWeightRecord[w$3] = (danmakuWeightRecord[w$3] || 0) + 1;
|
|
1426
1421
|
});
|
|
1427
1422
|
}
|
|
@@ -1436,12 +1431,12 @@ var ComRegister = class {
|
|
|
1436
1431
|
const liveMsgObj = this.liveMsgManager.get(uid);
|
|
1437
1432
|
const sendDanmakuWordCloud = async () => {
|
|
1438
1433
|
this.logger.info("开始制作弹幕词云");
|
|
1439
|
-
this.logger.info("正在获取前
|
|
1440
|
-
const
|
|
1441
|
-
this.logger.info("弹幕词云前
|
|
1442
|
-
this.logger.info(
|
|
1434
|
+
this.logger.info("正在获取前50热词");
|
|
1435
|
+
const top50Words = Object.entries(danmakuWeightRecord).sort((a$1, b$2) => b$2[1] - a$1[1]).slice(0, 50);
|
|
1436
|
+
this.logger.info("弹幕词云前50词及权重:");
|
|
1437
|
+
this.logger.info(top50Words);
|
|
1443
1438
|
this.logger.info("正在准备生成弹幕词云");
|
|
1444
|
-
const buffer = await this.ctx.gi.generateWordCloudImg(
|
|
1439
|
+
const buffer = await this.ctx.gi.generateWordCloudImg(top50Words, masterInfo.username);
|
|
1445
1440
|
this.logger.info("弹幕词云生成完成,正在准备发送词云图片");
|
|
1446
1441
|
await this.broadcastToTargets(uid, koishi.h.image(buffer, "image/jpeg"), PushType.Live);
|
|
1447
1442
|
};
|
|
@@ -1988,7 +1983,7 @@ var ComRegister = class {
|
|
|
1988
1983
|
dynamicDebugMode: koishi.Schema.boolean().required()
|
|
1989
1984
|
});
|
|
1990
1985
|
})(ComRegister || (ComRegister = {}));
|
|
1991
|
-
var
|
|
1986
|
+
var command_register_default = ComRegister;
|
|
1992
1987
|
|
|
1993
1988
|
//#endregion
|
|
1994
1989
|
//#region src/database.ts
|
|
@@ -84385,6 +84380,7 @@ var require_tar_fs = __commonJS$1({ "node_modules/tar-fs/index.js"(exports) {
|
|
|
84385
84380
|
const now = /* @__PURE__ */ new Date();
|
|
84386
84381
|
const umask = typeof opts.umask === "number" ? ~opts.umask : ~processUmask();
|
|
84387
84382
|
const strict = opts.strict !== false;
|
|
84383
|
+
const validateSymLinks = opts.validateSymlinks !== false;
|
|
84388
84384
|
let map = opts.map || noop;
|
|
84389
84385
|
let dmode = typeof opts.dmode === "number" ? opts.dmode : 0;
|
|
84390
84386
|
let fmode = typeof opts.fmode === "number" ? opts.fmode : 0;
|
|
@@ -84452,7 +84448,7 @@ var require_tar_fs = __commonJS$1({ "node_modules/tar-fs/index.js"(exports) {
|
|
|
84452
84448
|
if (win32$1) return next();
|
|
84453
84449
|
xfs.unlink(name$3, function() {
|
|
84454
84450
|
const dst = path$4.resolve(path$4.dirname(name$3), header.linkname);
|
|
84455
|
-
if (!inCwd(dst)) return next(/* @__PURE__ */ new Error(name$3 + " is not a valid symlink"));
|
|
84451
|
+
if (!inCwd(dst) && validateSymLinks) return next(/* @__PURE__ */ new Error(name$3 + " is not a valid symlink"));
|
|
84456
84452
|
xfs.symlink(header.linkname, name$3, stat);
|
|
84457
84453
|
});
|
|
84458
84454
|
}
|
|
@@ -93241,7 +93237,7 @@ var require_lib = __commonJS$1({ "node_modules/koishi-plugin-puppeteer/lib/index
|
|
|
93241
93237
|
} });
|
|
93242
93238
|
|
|
93243
93239
|
//#endregion
|
|
93244
|
-
//#region src/
|
|
93240
|
+
//#region src/generate_img.ts
|
|
93245
93241
|
var import_lib = __toESM$1(require_lib());
|
|
93246
93242
|
const DYNAMIC_TYPE_NONE = "DYNAMIC_TYPE_NONE";
|
|
93247
93243
|
const DYNAMIC_TYPE_FORWARD = "DYNAMIC_TYPE_FORWARD";
|
|
@@ -94533,6 +94529,7 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94533
94529
|
async generateWordCloudImg(words, masterName) {
|
|
94534
94530
|
const fontURL = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "font/HYZhengYuan-75W.ttf"));
|
|
94535
94531
|
const wordcloudJS = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "static/wordcloud2.min.js"));
|
|
94532
|
+
const renderFunc = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "static/render.js"));
|
|
94536
94533
|
const html = `
|
|
94537
94534
|
<!DOCTYPE html>
|
|
94538
94535
|
<html lang="zh-CN">
|
|
@@ -94540,7 +94537,6 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94540
94537
|
<head>
|
|
94541
94538
|
<meta charset="UTF-8">
|
|
94542
94539
|
<title>高清词云展示</title>
|
|
94543
|
-
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap" rel="stylesheet">
|
|
94544
94540
|
<style>
|
|
94545
94541
|
@font-face {
|
|
94546
94542
|
font-family: "Custom Font";
|
|
@@ -94606,6 +94602,7 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94606
94602
|
</div>
|
|
94607
94603
|
|
|
94608
94604
|
<script src="${wordcloudJS}"></script>
|
|
94605
|
+
<script src="${renderFunc}"></script>
|
|
94609
94606
|
<script>
|
|
94610
94607
|
const canvas = document.getElementById('wordCloudCanvas');
|
|
94611
94608
|
const ctx = canvas.getContext('2d');
|
|
@@ -94623,38 +94620,11 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94623
94620
|
|
|
94624
94621
|
const words = ${JSON.stringify(words)}
|
|
94625
94622
|
|
|
94626
|
-
|
|
94627
|
-
|
|
94628
|
-
|
|
94629
|
-
|
|
94630
|
-
|
|
94631
|
-
const maxFontSize = 80;
|
|
94632
|
-
const minFontSize = 14;
|
|
94633
|
-
|
|
94634
|
-
// 用映射函数代替 weightFactor
|
|
94635
|
-
function getWeightFactor(size) {
|
|
94636
|
-
if (maxWeight === minWeight) return maxFontSize; // 防止除0
|
|
94637
|
-
const ratio = (size - minWeight) / (maxWeight - minWeight);
|
|
94638
|
-
return minFontSize + (maxFontSize - minFontSize) * Math.pow(ratio, 0.85);
|
|
94639
|
-
}
|
|
94640
|
-
|
|
94641
|
-
WordCloud(canvas, {
|
|
94642
|
-
list: words,
|
|
94643
|
-
gridSize: Math.max(4, Math.round(5 * (cssWidth / 1024))),
|
|
94644
|
-
weightFactor: getWeightFactor,
|
|
94645
|
-
fontFamily: 'Quicksand, sans-serif',
|
|
94646
|
-
color: () => {
|
|
94647
|
-
const colors = ['#007CF0', '#00DFD8', '#7928CA', '#FF0080', '#FF4D4D', '#F9CB28'];
|
|
94648
|
-
return colors[Math.floor(Math.random() * colors.length)];
|
|
94649
|
-
},
|
|
94650
|
-
rotateRatio: 0.5,
|
|
94651
|
-
rotationSteps: 2,
|
|
94652
|
-
backgroundColor: 'transparent',
|
|
94653
|
-
drawOutOfBound: false,
|
|
94654
|
-
origin: [cssWidth / 2, cssHeight / 2], // 居中关键点
|
|
94655
|
-
// 明确告诉 wordcloud2 使用这个宽高(以 CSS 尺寸为准)
|
|
94656
|
-
width: cssWidth,
|
|
94657
|
-
height: cssHeight,
|
|
94623
|
+
renderAutoFitWordCloud(canvas, words, {
|
|
94624
|
+
maxFontSize: 40,
|
|
94625
|
+
minFontSize: 12,
|
|
94626
|
+
densityTarget: 0.3,
|
|
94627
|
+
weightExponent: 0.5
|
|
94658
94628
|
});
|
|
94659
94629
|
</script>
|
|
94660
94630
|
</body>
|
|
@@ -94755,7 +94725,7 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94755
94725
|
followerDisplay: koishi.Schema.boolean()
|
|
94756
94726
|
});
|
|
94757
94727
|
})(GenerateImg || (GenerateImg = {}));
|
|
94758
|
-
var
|
|
94728
|
+
var generate_img_default = GenerateImg;
|
|
94759
94729
|
|
|
94760
94730
|
//#endregion
|
|
94761
94731
|
//#region node_modules/@oxc-project/runtime/src/helpers/decorate.js
|
|
@@ -94770,7 +94740,7 @@ var require_decorate = __commonJS$1({ "node_modules/@oxc-project/runtime/src/hel
|
|
|
94770
94740
|
} });
|
|
94771
94741
|
|
|
94772
94742
|
//#endregion
|
|
94773
|
-
//#region src/
|
|
94743
|
+
//#region src/bili_api.ts
|
|
94774
94744
|
var import_decorate = __toESM$1(require_decorate());
|
|
94775
94745
|
const mixinKeyEncTab = [
|
|
94776
94746
|
46,
|
|
@@ -95463,10 +95433,10 @@ var BiliAPI = class extends koishi.Service {
|
|
|
95463
95433
|
key: koishi.Schema.string().pattern(/^[0-9a-f]{32}$/).required()
|
|
95464
95434
|
});
|
|
95465
95435
|
})(BiliAPI || (BiliAPI = {}));
|
|
95466
|
-
var
|
|
95436
|
+
var bili_api_default = BiliAPI;
|
|
95467
95437
|
|
|
95468
95438
|
//#endregion
|
|
95469
|
-
//#region src/
|
|
95439
|
+
//#region src/bili_live.ts
|
|
95470
95440
|
var BLive = class extends koishi.Service {
|
|
95471
95441
|
static inject = ["ba"];
|
|
95472
95442
|
listenerRecord = {};
|
|
@@ -95496,7 +95466,7 @@ var BLive = class extends koishi.Service {
|
|
|
95496
95466
|
this.logger.warn(`${roomId}直播间连接未成功关闭`);
|
|
95497
95467
|
}
|
|
95498
95468
|
};
|
|
95499
|
-
var
|
|
95469
|
+
var bili_live_default = BLive;
|
|
95500
95470
|
|
|
95501
95471
|
//#endregion
|
|
95502
95472
|
//#region src/index.ts
|
|
@@ -95538,11 +95508,11 @@ var ServerManager = class extends koishi.Service {
|
|
|
95538
95508
|
registerPlugin = () => {
|
|
95539
95509
|
if (this.servers.length !== 0) return false;
|
|
95540
95510
|
try {
|
|
95541
|
-
const ba = this.ctx.plugin(
|
|
95511
|
+
const ba = this.ctx.plugin(bili_api_default, {
|
|
95542
95512
|
userAgent: globalConfig.userAgent,
|
|
95543
95513
|
key: globalConfig.key
|
|
95544
95514
|
});
|
|
95545
|
-
const gi = this.ctx.plugin(
|
|
95515
|
+
const gi = this.ctx.plugin(generate_img_default, {
|
|
95546
95516
|
filter: globalConfig.filter,
|
|
95547
95517
|
removeBorder: globalConfig.removeBorder,
|
|
95548
95518
|
cardColorStart: globalConfig.cardColorStart,
|
|
@@ -95554,7 +95524,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
95554
95524
|
font: globalConfig.font,
|
|
95555
95525
|
followerDisplay: globalConfig.followerDisplay
|
|
95556
95526
|
});
|
|
95557
|
-
const cr = this.ctx.plugin(
|
|
95527
|
+
const cr = this.ctx.plugin(command_register_default, {
|
|
95558
95528
|
sub: globalConfig.sub,
|
|
95559
95529
|
master: globalConfig.master,
|
|
95560
95530
|
wordcloud: globalConfig.wordcloud,
|
|
@@ -95571,7 +95541,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
95571
95541
|
filter: globalConfig.filter,
|
|
95572
95542
|
dynamicDebugMode: globalConfig.dynamicDebugMode
|
|
95573
95543
|
});
|
|
95574
|
-
const bl = this.ctx.plugin(
|
|
95544
|
+
const bl = this.ctx.plugin(bili_live_default);
|
|
95575
95545
|
this.servers.push(ba);
|
|
95576
95546
|
this.servers.push(bl);
|
|
95577
95547
|
this.servers.push(gi);
|