@q78kg/koishi-plugin-text-censor 1.0.4-beta.3 → 1.0.4-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/index.js +4 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
@@ -64,15 +64,13 @@ function apply(ctx, config) {
|
|
64
64
|
ctx.plugin(import_censor.default);
|
65
65
|
ctx.get("censor").intercept({
|
66
66
|
async text(attrs) {
|
67
|
-
const
|
67
|
+
const originalText = attrs.content;
|
68
|
+
const result = await filter.filter(originalText);
|
68
69
|
if (typeof result.text !== "string")
|
69
70
|
return [];
|
70
71
|
if (config.removeWords) {
|
71
|
-
const
|
72
|
-
|
73
|
-
return text.replace(regex, "");
|
74
|
-
}, result.text);
|
75
|
-
return [filteredText.trim()];
|
72
|
+
const cleanedText = result.text.replace(/\*/g, "");
|
73
|
+
return [cleanedText.trim()];
|
76
74
|
} else {
|
77
75
|
return [result.text];
|
78
76
|
}
|