@q78kg/koishi-plugin-text-censor 1.0.4-beta.10 → 1.0.4-beta.11
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.d.ts +1 -1
- package/lib/index.js +3 -2
- package/package.json +2 -3
package/lib/index.d.ts
CHANGED
@@ -3,7 +3,7 @@ export declare const name = "text-censor";
|
|
3
3
|
export interface Config {
|
4
4
|
textDatabase: [string][];
|
5
5
|
removeWords: boolean;
|
6
|
-
|
6
|
+
caseStrategy: 'capital' | 'none' | 'lower';
|
7
7
|
}
|
8
8
|
export declare const Config: Schema<Config>;
|
9
9
|
export declare function apply(ctx: Context, config: Config): void;
|
package/lib/index.js
CHANGED
@@ -51,7 +51,8 @@ var Config = import_koishi.Schema.intersect([
|
|
51
51
|
}),
|
52
52
|
import_koishi.Schema.object({
|
53
53
|
removeWords: import_koishi.Schema.boolean().description("是否直接删除敏感词。").default(false),
|
54
|
-
|
54
|
+
caseStrategy: import_koishi.Schema.union(["none", "lower", "capital"]).description("敏感词处理时的大小写策略。").default("none")
|
55
|
+
// 默认不处理大小写
|
55
56
|
})
|
56
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
57
58
|
]);
|
@@ -80,7 +81,7 @@ function apply(ctx, config) {
|
|
80
81
|
return;
|
81
82
|
}
|
82
83
|
const mintOptions = {
|
83
|
-
transform: config.
|
84
|
+
transform: config.caseStrategy
|
84
85
|
};
|
85
86
|
const filter = new import_mint_filter.default(words, mintOptions);
|
86
87
|
ctx.plugin(import_censor.default);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@q78kg/koishi-plugin-text-censor",
|
3
3
|
"description": "A text censor provider for Koishi",
|
4
|
-
"version": "1.0.4-beta.
|
4
|
+
"version": "1.0.4-beta.11",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"typings": "lib/index.d.ts",
|
7
7
|
"files": [
|
@@ -33,8 +33,7 @@
|
|
33
33
|
]
|
34
34
|
},
|
35
35
|
"description": {
|
36
|
-
"
|
37
|
-
"zh": "文本敏感词过滤"
|
36
|
+
"zh": "文本敏感词过滤服务,支持多敏感词库"
|
38
37
|
}
|
39
38
|
},
|
40
39
|
"peerDependencies": {
|