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.mjs
CHANGED
|
@@ -4,7 +4,8 @@ import { resolve } from "path";
|
|
|
4
4
|
import QRCode from "qrcode";
|
|
5
5
|
import { CronJob } from "cron";
|
|
6
6
|
import { DateTime } from "luxon";
|
|
7
|
-
import {
|
|
7
|
+
import { Jieba } from "@node-rs/jieba";
|
|
8
|
+
import { dict } from "@node-rs/jieba/dict";
|
|
8
9
|
import { Fragment, jsx, jsxs } from "@satorijs/element/jsx-runtime";
|
|
9
10
|
import { resolve as resolve$1 } from "node:path";
|
|
10
11
|
import { pathToFileURL } from "node:url";
|
|
@@ -617,7 +618,142 @@ const PushTypeMsg = {
|
|
|
617
618
|
};
|
|
618
619
|
|
|
619
620
|
//#endregion
|
|
620
|
-
//#region src/
|
|
621
|
+
//#region src/stop_words.ts
|
|
622
|
+
const stopwords = new Set([
|
|
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
|
+
"以后",
|
|
667
|
+
"以前的",
|
|
668
|
+
"the",
|
|
669
|
+
"and",
|
|
670
|
+
"to",
|
|
671
|
+
"of",
|
|
672
|
+
"a",
|
|
673
|
+
"is",
|
|
674
|
+
"in",
|
|
675
|
+
"on",
|
|
676
|
+
"for",
|
|
677
|
+
"with",
|
|
678
|
+
"this",
|
|
679
|
+
"that",
|
|
680
|
+
"you",
|
|
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
|
+
]);
|
|
754
|
+
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region src/command_register.tsx
|
|
621
757
|
var import_lib$1 = __toESM$1(require_lib$3());
|
|
622
758
|
var ComRegister = class {
|
|
623
759
|
static inject = [
|
|
@@ -650,7 +786,7 @@ var ComRegister = class {
|
|
|
650
786
|
privateBot;
|
|
651
787
|
dynamicJob;
|
|
652
788
|
liveJob;
|
|
653
|
-
|
|
789
|
+
_jieba = Jieba.withDict(dict);
|
|
654
790
|
constructor(ctx, config) {
|
|
655
791
|
this.ctx = ctx;
|
|
656
792
|
this.init(config);
|
|
@@ -801,196 +937,56 @@ var ComRegister = class {
|
|
|
801
937
|
});
|
|
802
938
|
biliCom.subcommand(".wc").action(async ({ session }) => {
|
|
803
939
|
const words = [
|
|
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
|
-
["
|
|
853
|
-
["
|
|
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]
|
|
940
|
+
["弹幕护体", 77],
|
|
941
|
+
["笑死", 30],
|
|
942
|
+
["泪目", 45],
|
|
943
|
+
["加油", 70],
|
|
944
|
+
["???", 80],
|
|
945
|
+
["我可以", 66],
|
|
946
|
+
["无语", 55],
|
|
947
|
+
["梦开始的地方", 1],
|
|
948
|
+
["太真实了", 8],
|
|
949
|
+
["我哭死", 1],
|
|
950
|
+
["人呢", 2],
|
|
951
|
+
["有点意思", 4],
|
|
952
|
+
["妙啊", 4],
|
|
953
|
+
["这波啊", 11],
|
|
954
|
+
["懂了", 6],
|
|
955
|
+
["破防了", 65],
|
|
956
|
+
["蚌埠住了", 92],
|
|
957
|
+
["草", 100],
|
|
958
|
+
["针不戳", 68],
|
|
959
|
+
["yyds", 50],
|
|
960
|
+
["DNA动了", 58],
|
|
961
|
+
["猝不及防", 40],
|
|
962
|
+
["建议加精", 15],
|
|
963
|
+
["保护", 22],
|
|
964
|
+
["害怕", 18],
|
|
965
|
+
["就这?", 99],
|
|
966
|
+
["2333", 20],
|
|
967
|
+
["公开处刑", 35],
|
|
968
|
+
["血压上来了", 45],
|
|
969
|
+
["整不会了", 32],
|
|
970
|
+
["见证历史", 88],
|
|
971
|
+
["下次一定", 65],
|
|
972
|
+
["奥利给", 56],
|
|
973
|
+
["求更新", 18],
|
|
974
|
+
["真实", 20],
|
|
975
|
+
["好活当赏", 25],
|
|
976
|
+
["泪,冲了出来", 68],
|
|
977
|
+
["刻进DNA", 70],
|
|
978
|
+
["我直接好家伙", 55],
|
|
979
|
+
["夺笋啊", 40],
|
|
980
|
+
["歪歪滴艾斯", 1],
|
|
981
|
+
["典中典", 5],
|
|
982
|
+
["麻中麻", 3],
|
|
983
|
+
["绷不住了", 8],
|
|
984
|
+
["逆天", 95],
|
|
985
|
+
["寄", 65],
|
|
986
|
+
["孝", 20],
|
|
987
|
+
["乐", 101],
|
|
988
|
+
["急急急", 3],
|
|
989
|
+
["典", 5]
|
|
994
990
|
];
|
|
995
991
|
await session.send(/* @__PURE__ */ jsx("message", { children: h.image(await this.ctx.gi.generateWordCloudImg(words, "词云测试"), "image/jpg") }));
|
|
996
992
|
});
|
|
@@ -1123,7 +1119,7 @@ var ComRegister = class {
|
|
|
1123
1119
|
}
|
|
1124
1120
|
async broadcastToTargets(uid, content, type, retry = 3e3) {
|
|
1125
1121
|
if (!this.checkAllBotsAreReady()) {
|
|
1126
|
-
this.logger.error(
|
|
1122
|
+
this.logger.error(`存在机器人未初始化完毕,无法进行推送,${retry / 1e3}秒后重试`);
|
|
1127
1123
|
this.ctx.setTimeout(() => {
|
|
1128
1124
|
this.broadcastToTargets(uid, content, type, retry * 2);
|
|
1129
1125
|
}, retry);
|
|
@@ -1138,7 +1134,7 @@ var ComRegister = class {
|
|
|
1138
1134
|
const success = await withRetry(async () => {
|
|
1139
1135
|
return await this.ctx.broadcast(atAllArr, /* @__PURE__ */ jsx("message", { children: /* @__PURE__ */ jsx("at", { type: "all" }) }));
|
|
1140
1136
|
}, 1);
|
|
1141
|
-
this.logger.info(
|
|
1137
|
+
this.logger.info(`成功推送全体成员消息:${success.length}条`);
|
|
1142
1138
|
}
|
|
1143
1139
|
if (type === PushType.Dynamic && record.dynamicArr?.length >= 1) {
|
|
1144
1140
|
this.logger.info(record.dynamicArr);
|
|
@@ -1146,7 +1142,7 @@ var ComRegister = class {
|
|
|
1146
1142
|
const success = await withRetry(async () => {
|
|
1147
1143
|
return await this.ctx.broadcast(dynamicArr, /* @__PURE__ */ jsx("message", { children: content }));
|
|
1148
1144
|
}, 1);
|
|
1149
|
-
this.logger.info(
|
|
1145
|
+
this.logger.info(`成功推送动态消息:${success.length}条`);
|
|
1150
1146
|
}
|
|
1151
1147
|
if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length >= 1) {
|
|
1152
1148
|
this.logger.info(record.liveArr);
|
|
@@ -1154,7 +1150,7 @@ var ComRegister = class {
|
|
|
1154
1150
|
const success = await withRetry(async () => {
|
|
1155
1151
|
return await this.ctx.broadcast(liveArr, /* @__PURE__ */ jsx("message", { children: content }));
|
|
1156
1152
|
}, 1);
|
|
1157
|
-
this.logger.info(
|
|
1153
|
+
this.logger.info(`成功推送直播消息:${success.length}条`);
|
|
1158
1154
|
}
|
|
1159
1155
|
if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length >= 1) {
|
|
1160
1156
|
this.logger.info(record.liveGuardBuyArr);
|
|
@@ -1162,7 +1158,7 @@ var ComRegister = class {
|
|
|
1162
1158
|
const success = await withRetry(async () => {
|
|
1163
1159
|
return await this.ctx.broadcast(liveGuardBuyArr, /* @__PURE__ */ jsx("message", { children: content }));
|
|
1164
1160
|
}, 1);
|
|
1165
|
-
this.logger.info(
|
|
1161
|
+
this.logger.info(`成功推送上舰消息:${success.length}条`);
|
|
1166
1162
|
}
|
|
1167
1163
|
return;
|
|
1168
1164
|
}
|
|
@@ -1422,8 +1418,7 @@ var ComRegister = class {
|
|
|
1422
1418
|
return await this.broadcastToTargets(uid, msg, liveType === LiveType.StartBroadcasting ? PushType.StartBroadcasting : PushType.Live);
|
|
1423
1419
|
}
|
|
1424
1420
|
async segmentDanmaku(danmaku, danmakuWeightRecord) {
|
|
1425
|
-
this.
|
|
1426
|
-
if (p$1 && p$1 === 2048) return;
|
|
1421
|
+
this._jieba.cut(danmaku, true).filter((word) => word.length >= 2 && !stopwords.has(word)).map((w$3) => {
|
|
1427
1422
|
danmakuWeightRecord[w$3] = (danmakuWeightRecord[w$3] || 0) + 1;
|
|
1428
1423
|
});
|
|
1429
1424
|
}
|
|
@@ -1438,12 +1433,12 @@ var ComRegister = class {
|
|
|
1438
1433
|
const liveMsgObj = this.liveMsgManager.get(uid);
|
|
1439
1434
|
const sendDanmakuWordCloud = async () => {
|
|
1440
1435
|
this.logger.info("开始制作弹幕词云");
|
|
1441
|
-
this.logger.info("正在获取前
|
|
1442
|
-
const
|
|
1443
|
-
this.logger.info("弹幕词云前
|
|
1444
|
-
this.logger.info(
|
|
1436
|
+
this.logger.info("正在获取前50热词");
|
|
1437
|
+
const top50Words = Object.entries(danmakuWeightRecord).sort((a$1, b$2) => b$2[1] - a$1[1]).slice(0, 50);
|
|
1438
|
+
this.logger.info("弹幕词云前50词及权重:");
|
|
1439
|
+
this.logger.info(top50Words);
|
|
1445
1440
|
this.logger.info("正在准备生成弹幕词云");
|
|
1446
|
-
const buffer = await this.ctx.gi.generateWordCloudImg(
|
|
1441
|
+
const buffer = await this.ctx.gi.generateWordCloudImg(top50Words, masterInfo.username);
|
|
1447
1442
|
this.logger.info("弹幕词云生成完成,正在准备发送词云图片");
|
|
1448
1443
|
await this.broadcastToTargets(uid, h.image(buffer, "image/jpeg"), PushType.Live);
|
|
1449
1444
|
};
|
|
@@ -1990,7 +1985,7 @@ var ComRegister = class {
|
|
|
1990
1985
|
dynamicDebugMode: Schema.boolean().required()
|
|
1991
1986
|
});
|
|
1992
1987
|
})(ComRegister || (ComRegister = {}));
|
|
1993
|
-
var
|
|
1988
|
+
var command_register_default = ComRegister;
|
|
1994
1989
|
|
|
1995
1990
|
//#endregion
|
|
1996
1991
|
//#region src/database.ts
|
|
@@ -84387,6 +84382,7 @@ var require_tar_fs = __commonJS$1({ "node_modules/tar-fs/index.js"(exports) {
|
|
|
84387
84382
|
const now = /* @__PURE__ */ new Date();
|
|
84388
84383
|
const umask = typeof opts.umask === "number" ? ~opts.umask : ~processUmask();
|
|
84389
84384
|
const strict = opts.strict !== false;
|
|
84385
|
+
const validateSymLinks = opts.validateSymlinks !== false;
|
|
84390
84386
|
let map = opts.map || noop;
|
|
84391
84387
|
let dmode = typeof opts.dmode === "number" ? opts.dmode : 0;
|
|
84392
84388
|
let fmode = typeof opts.fmode === "number" ? opts.fmode : 0;
|
|
@@ -84454,7 +84450,7 @@ var require_tar_fs = __commonJS$1({ "node_modules/tar-fs/index.js"(exports) {
|
|
|
84454
84450
|
if (win32$1) return next();
|
|
84455
84451
|
xfs.unlink(name$3, function() {
|
|
84456
84452
|
const dst = path$3.resolve(path$3.dirname(name$3), header.linkname);
|
|
84457
|
-
if (!inCwd(dst)) return next(/* @__PURE__ */ new Error(name$3 + " is not a valid symlink"));
|
|
84453
|
+
if (!inCwd(dst) && validateSymLinks) return next(/* @__PURE__ */ new Error(name$3 + " is not a valid symlink"));
|
|
84458
84454
|
xfs.symlink(header.linkname, name$3, stat);
|
|
84459
84455
|
});
|
|
84460
84456
|
}
|
|
@@ -93243,7 +93239,7 @@ var require_lib = __commonJS$1({ "node_modules/koishi-plugin-puppeteer/lib/index
|
|
|
93243
93239
|
} });
|
|
93244
93240
|
|
|
93245
93241
|
//#endregion
|
|
93246
|
-
//#region src/
|
|
93242
|
+
//#region src/generate_img.ts
|
|
93247
93243
|
var import_lib = __toESM$1(require_lib());
|
|
93248
93244
|
const DYNAMIC_TYPE_NONE = "DYNAMIC_TYPE_NONE";
|
|
93249
93245
|
const DYNAMIC_TYPE_FORWARD = "DYNAMIC_TYPE_FORWARD";
|
|
@@ -94535,6 +94531,7 @@ var GenerateImg = class extends Service {
|
|
|
94535
94531
|
async generateWordCloudImg(words, masterName) {
|
|
94536
94532
|
const fontURL = pathToFileURL(resolve$1(__dirname, "font/HYZhengYuan-75W.ttf"));
|
|
94537
94533
|
const wordcloudJS = pathToFileURL(resolve$1(__dirname, "static/wordcloud2.min.js"));
|
|
94534
|
+
const renderFunc = pathToFileURL(resolve$1(__dirname, "static/render.js"));
|
|
94538
94535
|
const html = `
|
|
94539
94536
|
<!DOCTYPE html>
|
|
94540
94537
|
<html lang="zh-CN">
|
|
@@ -94542,7 +94539,6 @@ var GenerateImg = class extends Service {
|
|
|
94542
94539
|
<head>
|
|
94543
94540
|
<meta charset="UTF-8">
|
|
94544
94541
|
<title>高清词云展示</title>
|
|
94545
|
-
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap" rel="stylesheet">
|
|
94546
94542
|
<style>
|
|
94547
94543
|
@font-face {
|
|
94548
94544
|
font-family: "Custom Font";
|
|
@@ -94608,6 +94604,7 @@ var GenerateImg = class extends Service {
|
|
|
94608
94604
|
</div>
|
|
94609
94605
|
|
|
94610
94606
|
<script src="${wordcloudJS}"></script>
|
|
94607
|
+
<script src="${renderFunc}"></script>
|
|
94611
94608
|
<script>
|
|
94612
94609
|
const canvas = document.getElementById('wordCloudCanvas');
|
|
94613
94610
|
const ctx = canvas.getContext('2d');
|
|
@@ -94625,38 +94622,11 @@ var GenerateImg = class extends Service {
|
|
|
94625
94622
|
|
|
94626
94623
|
const words = ${JSON.stringify(words)}
|
|
94627
94624
|
|
|
94628
|
-
|
|
94629
|
-
|
|
94630
|
-
|
|
94631
|
-
|
|
94632
|
-
|
|
94633
|
-
const maxFontSize = 80;
|
|
94634
|
-
const minFontSize = 14;
|
|
94635
|
-
|
|
94636
|
-
// 用映射函数代替 weightFactor
|
|
94637
|
-
function getWeightFactor(size) {
|
|
94638
|
-
if (maxWeight === minWeight) return maxFontSize; // 防止除0
|
|
94639
|
-
const ratio = (size - minWeight) / (maxWeight - minWeight);
|
|
94640
|
-
return minFontSize + (maxFontSize - minFontSize) * Math.pow(ratio, 0.85);
|
|
94641
|
-
}
|
|
94642
|
-
|
|
94643
|
-
WordCloud(canvas, {
|
|
94644
|
-
list: words,
|
|
94645
|
-
gridSize: Math.max(4, Math.round(5 * (cssWidth / 1024))),
|
|
94646
|
-
weightFactor: getWeightFactor,
|
|
94647
|
-
fontFamily: 'Quicksand, sans-serif',
|
|
94648
|
-
color: () => {
|
|
94649
|
-
const colors = ['#007CF0', '#00DFD8', '#7928CA', '#FF0080', '#FF4D4D', '#F9CB28'];
|
|
94650
|
-
return colors[Math.floor(Math.random() * colors.length)];
|
|
94651
|
-
},
|
|
94652
|
-
rotateRatio: 0.5,
|
|
94653
|
-
rotationSteps: 2,
|
|
94654
|
-
backgroundColor: 'transparent',
|
|
94655
|
-
drawOutOfBound: false,
|
|
94656
|
-
origin: [cssWidth / 2, cssHeight / 2], // 居中关键点
|
|
94657
|
-
// 明确告诉 wordcloud2 使用这个宽高(以 CSS 尺寸为准)
|
|
94658
|
-
width: cssWidth,
|
|
94659
|
-
height: cssHeight,
|
|
94625
|
+
renderAutoFitWordCloud(canvas, words, {
|
|
94626
|
+
maxFontSize: 40,
|
|
94627
|
+
minFontSize: 12,
|
|
94628
|
+
densityTarget: 0.3,
|
|
94629
|
+
weightExponent: 0.5
|
|
94660
94630
|
});
|
|
94661
94631
|
</script>
|
|
94662
94632
|
</body>
|
|
@@ -94757,7 +94727,7 @@ var GenerateImg = class extends Service {
|
|
|
94757
94727
|
followerDisplay: Schema.boolean()
|
|
94758
94728
|
});
|
|
94759
94729
|
})(GenerateImg || (GenerateImg = {}));
|
|
94760
|
-
var
|
|
94730
|
+
var generate_img_default = GenerateImg;
|
|
94761
94731
|
|
|
94762
94732
|
//#endregion
|
|
94763
94733
|
//#region node_modules/@oxc-project/runtime/src/helpers/decorate.js
|
|
@@ -94772,7 +94742,7 @@ var require_decorate = __commonJS$1({ "node_modules/@oxc-project/runtime/src/hel
|
|
|
94772
94742
|
} });
|
|
94773
94743
|
|
|
94774
94744
|
//#endregion
|
|
94775
|
-
//#region src/
|
|
94745
|
+
//#region src/bili_api.ts
|
|
94776
94746
|
var import_decorate = __toESM$1(require_decorate());
|
|
94777
94747
|
const mixinKeyEncTab = [
|
|
94778
94748
|
46,
|
|
@@ -95465,10 +95435,10 @@ var BiliAPI = class extends Service {
|
|
|
95465
95435
|
key: Schema.string().pattern(/^[0-9a-f]{32}$/).required()
|
|
95466
95436
|
});
|
|
95467
95437
|
})(BiliAPI || (BiliAPI = {}));
|
|
95468
|
-
var
|
|
95438
|
+
var bili_api_default = BiliAPI;
|
|
95469
95439
|
|
|
95470
95440
|
//#endregion
|
|
95471
|
-
//#region src/
|
|
95441
|
+
//#region src/bili_live.ts
|
|
95472
95442
|
var BLive = class extends Service {
|
|
95473
95443
|
static inject = ["ba"];
|
|
95474
95444
|
listenerRecord = {};
|
|
@@ -95498,7 +95468,7 @@ var BLive = class extends Service {
|
|
|
95498
95468
|
this.logger.warn(`${roomId}直播间连接未成功关闭`);
|
|
95499
95469
|
}
|
|
95500
95470
|
};
|
|
95501
|
-
var
|
|
95471
|
+
var bili_live_default = BLive;
|
|
95502
95472
|
|
|
95503
95473
|
//#endregion
|
|
95504
95474
|
//#region src/index.ts
|
|
@@ -95540,11 +95510,11 @@ var ServerManager = class extends Service {
|
|
|
95540
95510
|
registerPlugin = () => {
|
|
95541
95511
|
if (this.servers.length !== 0) return false;
|
|
95542
95512
|
try {
|
|
95543
|
-
const ba = this.ctx.plugin(
|
|
95513
|
+
const ba = this.ctx.plugin(bili_api_default, {
|
|
95544
95514
|
userAgent: globalConfig.userAgent,
|
|
95545
95515
|
key: globalConfig.key
|
|
95546
95516
|
});
|
|
95547
|
-
const gi = this.ctx.plugin(
|
|
95517
|
+
const gi = this.ctx.plugin(generate_img_default, {
|
|
95548
95518
|
filter: globalConfig.filter,
|
|
95549
95519
|
removeBorder: globalConfig.removeBorder,
|
|
95550
95520
|
cardColorStart: globalConfig.cardColorStart,
|
|
@@ -95556,7 +95526,7 @@ var ServerManager = class extends Service {
|
|
|
95556
95526
|
font: globalConfig.font,
|
|
95557
95527
|
followerDisplay: globalConfig.followerDisplay
|
|
95558
95528
|
});
|
|
95559
|
-
const cr = this.ctx.plugin(
|
|
95529
|
+
const cr = this.ctx.plugin(command_register_default, {
|
|
95560
95530
|
sub: globalConfig.sub,
|
|
95561
95531
|
master: globalConfig.master,
|
|
95562
95532
|
wordcloud: globalConfig.wordcloud,
|
|
@@ -95573,7 +95543,7 @@ var ServerManager = class extends Service {
|
|
|
95573
95543
|
filter: globalConfig.filter,
|
|
95574
95544
|
dynamicDebugMode: globalConfig.dynamicDebugMode
|
|
95575
95545
|
});
|
|
95576
|
-
const bl = this.ctx.plugin(
|
|
95546
|
+
const bl = this.ctx.plugin(bili_live_default);
|
|
95577
95547
|
this.servers.push(ba);
|
|
95578
95548
|
this.servers.push(bl);
|
|
95579
95549
|
this.servers.push(gi);
|