koishi-plugin-chatluna-character 0.0.78 → 0.0.80
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.cjs +10 -3
- package/lib/index.mjs +10 -3
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -264,7 +264,7 @@ function splitSentence(text) {
|
|
|
264
264
|
}
|
|
265
265
|
__name(splitSentence, "splitSentence");
|
|
266
266
|
function matchAt(str) {
|
|
267
|
-
const atRegex = /<at[^>]*>(.*?)<\/at
|
|
267
|
+
const atRegex = /<at[^>]*>(.*?)<\/at>/gs;
|
|
268
268
|
return [...str.matchAll(atRegex)].map((item) => {
|
|
269
269
|
return {
|
|
270
270
|
at: item[1],
|
|
@@ -660,7 +660,14 @@ async function apply2(ctx, config) {
|
|
|
660
660
|
maxRecentMessage++;
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
|
-
|
|
663
|
+
let isAt = session.stripped.appel;
|
|
664
|
+
for (const element of session.elements) {
|
|
665
|
+
if (element.type === "at" && element.attrs.id === session.bot.selfId) {
|
|
666
|
+
isAt = true;
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (copyOfConfig.isForceMute && isAt && currentPreset.mute_keyword?.length > 0) {
|
|
664
671
|
const needMute = currentPreset.mute_keyword.some(
|
|
665
672
|
(value) => message.content.includes(value)
|
|
666
673
|
);
|
|
@@ -1157,7 +1164,7 @@ var MessageCollector = class extends import_koishi6.Service {
|
|
|
1157
1164
|
const message = {
|
|
1158
1165
|
content,
|
|
1159
1166
|
name: session.bot.user.name,
|
|
1160
|
-
id: session.bot.
|
|
1167
|
+
id: session.bot.selfId ?? "0"
|
|
1161
1168
|
};
|
|
1162
1169
|
groupArray.push(message);
|
|
1163
1170
|
if (groupArray.length > maxMessageSize) {
|
package/lib/index.mjs
CHANGED
|
@@ -232,7 +232,7 @@ function splitSentence(text) {
|
|
|
232
232
|
}
|
|
233
233
|
__name(splitSentence, "splitSentence");
|
|
234
234
|
function matchAt(str) {
|
|
235
|
-
const atRegex = /<at[^>]*>(.*?)<\/at
|
|
235
|
+
const atRegex = /<at[^>]*>(.*?)<\/at>/gs;
|
|
236
236
|
return [...str.matchAll(atRegex)].map((item) => {
|
|
237
237
|
return {
|
|
238
238
|
at: item[1],
|
|
@@ -628,7 +628,14 @@ async function apply2(ctx, config) {
|
|
|
628
628
|
maxRecentMessage++;
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
|
|
631
|
+
let isAt = session.stripped.appel;
|
|
632
|
+
for (const element of session.elements) {
|
|
633
|
+
if (element.type === "at" && element.attrs.id === session.bot.selfId) {
|
|
634
|
+
isAt = true;
|
|
635
|
+
break;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (copyOfConfig.isForceMute && isAt && currentPreset.mute_keyword?.length > 0) {
|
|
632
639
|
const needMute = currentPreset.mute_keyword.some(
|
|
633
640
|
(value) => message.content.includes(value)
|
|
634
641
|
);
|
|
@@ -1126,7 +1133,7 @@ var MessageCollector = class extends Service {
|
|
|
1126
1133
|
const message = {
|
|
1127
1134
|
content,
|
|
1128
1135
|
name: session.bot.user.name,
|
|
1129
|
-
id: session.bot.
|
|
1136
|
+
id: session.bot.selfId ?? "0"
|
|
1130
1137
|
};
|
|
1131
1138
|
groupArray.push(message);
|
|
1132
1139
|
if (groupArray.length > maxMessageSize) {
|
package/package.json
CHANGED