dsh-qq-moony 0.8.0 → 0.8.1
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/CHANGELOG.md +3 -0
- package/client.js +22 -2
- package/index.js +12 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/client.js
CHANGED
|
@@ -109,7 +109,8 @@ window.__ModuleLoader__.load({
|
|
|
109
109
|
qzoneMinMin: 状态?.qzoneMinMin ?? 120,
|
|
110
110
|
qzoneMinMax: 状态?.qzoneMinMax ?? 240,
|
|
111
111
|
qzonePrompt: 状态?.qzonePrompt ?? '',
|
|
112
|
-
persona: 状态?.persona ?? '',
|
|
112
|
+
persona: 状态?.persona ?? '',
|
|
113
|
+
stickerLimit: 状态?.stickerLimit ?? 200,
|
|
113
114
|
groupWhitelist: (状态?.groupWhitelist ?? []).join(' '),
|
|
114
115
|
groupContextSize: 状态?.groupContextSize ?? 30,
|
|
115
116
|
groupEveryMinMin: 状态?.groupEveryMinMin ?? 8,
|
|
@@ -140,7 +141,8 @@ window.__ModuleLoader__.load({
|
|
|
140
141
|
qzoneMinMin: Number(值.qzoneMinMin),
|
|
141
142
|
qzoneMinMax: Number(值.qzoneMinMax),
|
|
142
143
|
qzonePrompt: String(值.qzonePrompt ?? ''),
|
|
143
|
-
persona: String(值.persona ?? ''),
|
|
144
|
+
persona: String(值.persona ?? ''),
|
|
145
|
+
stickerLimit: Number(值.stickerLimit),
|
|
144
146
|
groupWhitelist: String(值.groupWhitelist ?? ''),
|
|
145
147
|
groupContextSize: Number(值.groupContextSize),
|
|
146
148
|
groupEveryMinMin: Number(值.groupEveryMinMin),
|
|
@@ -504,6 +506,24 @@ window.__ModuleLoader__.load({
|
|
|
504
506
|
),
|
|
505
507
|
h(开关, { 开: 状态.autoTagStickers, 点: () => 改({ autoTagStickers: !状态.autoTagStickers }) }),
|
|
506
508
|
),
|
|
509
|
+
h(
|
|
510
|
+
'div',
|
|
511
|
+
{ style: { ...卡片 } },
|
|
512
|
+
h(
|
|
513
|
+
'div',
|
|
514
|
+
null,
|
|
515
|
+
h('div', { style: 标题 }, '表情库上限'),
|
|
516
|
+
h('div', { style: 说明 }, `现在存了 ${状态.stickerCount ?? 0} 张。超过上限时淘汰最旧的记录(原文件不删)`),
|
|
517
|
+
),
|
|
518
|
+
h('input', {
|
|
519
|
+
type: 'number',
|
|
520
|
+
min: 1,
|
|
521
|
+
max: 2000,
|
|
522
|
+
value: 值.stickerLimit,
|
|
523
|
+
onChange: (e) => 数字('stickerLimit', Number(e.target.value)),
|
|
524
|
+
style: 输入框,
|
|
525
|
+
}),
|
|
526
|
+
),
|
|
507
527
|
h(
|
|
508
528
|
'div',
|
|
509
529
|
{ style: { display: 'flex', justifyContent: 'flex-end', gap: '10px', alignItems: 'center' } },
|
package/index.js
CHANGED
|
@@ -63,6 +63,8 @@ const 默认配置 = {
|
|
|
63
63
|
qzoneEveryMinMax: 240,
|
|
64
64
|
// 发完消息要不要考虑配表情包
|
|
65
65
|
stickerOnReply: true,
|
|
66
|
+
// 表情库最多存几张(超了淘汰最旧的记录,不动原文件)
|
|
67
|
+
stickerLimit: 200,
|
|
66
68
|
// 收到图要不要鉴定一下、收进表情库
|
|
67
69
|
autoTagStickers: true,
|
|
68
70
|
// 上限开关:true = 不限条数(有些场景确实需要)
|
|
@@ -790,7 +792,9 @@ export function apply(ctx, 配置) {
|
|
|
790
792
|
groupPerDay: Number(c.groupPerDay ?? 20),
|
|
791
793
|
limitsUnlimited: c.limitsUnlimited === true,
|
|
792
794
|
stickerOnReply: c.stickerOnReply !== false,
|
|
793
|
-
autoTagStickers: c.autoTagStickers !== false,
|
|
795
|
+
autoTagStickers: c.autoTagStickers !== false,
|
|
796
|
+
stickerLimit: Number(c.stickerLimit ?? 200),
|
|
797
|
+
stickerCount: 读表情库().length,
|
|
794
798
|
perHour: Number(c.perHour ?? 20),
|
|
795
799
|
perDay: Number(c.perDay ?? 60),
|
|
796
800
|
sentToday: 记录.filter((t) => 现在 - t < 86400).length,
|
|
@@ -819,7 +823,8 @@ export function apply(ctx, 配置) {
|
|
|
819
823
|
if (Number.isFinite(想要.perDay)) patch.perDay = Math.min(1000, Math.max(1, Math.round(Number(想要.perDay))));
|
|
820
824
|
if (typeof 想要.limitsUnlimited === 'boolean') patch.limitsUnlimited = 想要.limitsUnlimited;
|
|
821
825
|
if (typeof 想要.stickerOnReply === 'boolean') patch.stickerOnReply = 想要.stickerOnReply;
|
|
822
|
-
if (typeof 想要.autoTagStickers === 'boolean') patch.autoTagStickers = 想要.autoTagStickers;
|
|
826
|
+
if (typeof 想要.autoTagStickers === 'boolean') patch.autoTagStickers = 想要.autoTagStickers;
|
|
827
|
+
if (Number.isFinite(想要.stickerLimit)) patch.stickerLimit = Math.min(2000, Math.max(1, Math.round(Number(想要.stickerLimit))));
|
|
823
828
|
if (typeof 想要.persona === 'string') patch.persona = 想要.persona.slice(0, 2000);
|
|
824
829
|
if (typeof 想要.qzoneAuto === 'boolean') patch.qzoneAuto = 想要.qzoneAuto;
|
|
825
830
|
if (typeof 想要.qzonePrompt === 'string') patch.qzonePrompt = 想要.qzonePrompt.slice(0, 2000);
|
|
@@ -1118,6 +1123,11 @@ export function apply(ctx, 配置) {
|
|
|
1118
1123
|
const 指纹 = 文件指纹(路径);
|
|
1119
1124
|
const 库 = 读表情库();
|
|
1120
1125
|
if (指纹 && 库.some((x) => x.hash === 指纹)) return { ok: true, added: false };
|
|
1126
|
+
const 上限 = Math.max(1, Number(c.stickerLimit ?? 200));
|
|
1127
|
+
while (库.length >= 上限) {
|
|
1128
|
+
const 淘汰 = 库.shift();
|
|
1129
|
+
记调试(`表情库满(${上限}),淘汰最旧的:${淘汰?.path ?? '?'}`);
|
|
1130
|
+
}
|
|
1121
1131
|
const 条目 = {
|
|
1122
1132
|
path: 路径,
|
|
1123
1133
|
hash: 指纹,
|