@zhin.js/plugin-repeater 1.1.10 → 1.1.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/README.md +7 -5
- package/lib/config.d.ts +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +1 -1
- package/lib/config.js.map +1 -1
- package/package.json +9 -8
- package/plugin.js +0 -2
- package/schema.json +38 -0
- package/src/config.ts +1 -1
package/README.md
CHANGED
|
@@ -10,14 +10,16 @@ pnpm exec zhin install @zhin.js/plugin-repeater
|
|
|
10
10
|
|
|
11
11
|
## 配置
|
|
12
12
|
|
|
13
|
-
在应用目录运行安装命令,会安装依赖并挂载到 `
|
|
13
|
+
在应用目录运行安装命令,会安装依赖并挂载到 主配置 `plugins` 映射,实例名为 `repeater`。在 `zhin.config.yml` 的实例节点修改配置:
|
|
14
14
|
|
|
15
15
|
```yaml
|
|
16
|
+
configVersion: 2
|
|
16
17
|
plugins:
|
|
17
|
-
repeater:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
repeater: "@zhin.js/plugin-repeater"
|
|
19
|
+
repeater:
|
|
20
|
+
threshold: 3 # 触发复读的最少人数(默认 3)
|
|
21
|
+
cooldown: 30000 # 同一群冷却时间,毫秒(默认 30s)
|
|
22
|
+
maxLength: 200 # 消息长度上限,超过不触发(默认 200)
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
配置声明位于 `src/config.ts`,由 `plugin.ts` 暴露给 Runtime 与 Console;默认值、类型、范围和表单说明由同一声明生成。配置不满足范围或含未知字段时,候选代不会激活;有效配置更新只重载插件。
|
package/lib/config.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const DEFAULT_REPEATER_CONFIG: Readonly<{
|
|
|
4
4
|
cooldown: 30000;
|
|
5
5
|
maxLength: 200;
|
|
6
6
|
}>;
|
|
7
|
-
/**
|
|
7
|
+
/** Authoring declaration; scripts/sync-plugin-config-schemas.mjs generates the packaged schema.json for Runtime and Console. */
|
|
8
8
|
export declare const repeaterConfig: Schema<Schema.InputRecord<{
|
|
9
9
|
threshold: Schema<number, number> & Schema.Present;
|
|
10
10
|
cooldown: Schema<number, number> & Schema.Present;
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,eAAO,MAAM,uBAAuB;;;;EAIlC,CAAC;AAEH,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,eAAO,MAAM,uBAAuB;;;;EAIlC,CAAC;AAEH,gIAAgI;AAChI,eAAO,MAAM,cAAc;;;;;;;;OAIzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
package/lib/config.js
CHANGED
|
@@ -4,7 +4,7 @@ export const DEFAULT_REPEATER_CONFIG = Object.freeze({
|
|
|
4
4
|
cooldown: 30_000,
|
|
5
5
|
maxLength: 200,
|
|
6
6
|
});
|
|
7
|
-
/**
|
|
7
|
+
/** Authoring declaration; scripts/sync-plugin-config-schemas.mjs generates the packaged schema.json for Runtime and Console. */
|
|
8
8
|
export const repeaterConfig = Schema.object({
|
|
9
9
|
threshold: Schema.number().min(2).max(10).step(1).default(DEFAULT_REPEATER_CONFIG.threshold).description('触发复读的最少人数').effect('reload'),
|
|
10
10
|
cooldown: Schema.number().min(5_000).max(300_000).default(DEFAULT_REPEATER_CONFIG.cooldown).description('同一群冷却时间 (ms)').effect('reload'),
|
package/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAA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,CAAC;CACxI,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-repeater",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "Repeater plugin for Zhin.js — auto-repeat when group members echo the same content (Plugin Runtime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"src",
|
|
20
20
|
"lib",
|
|
21
21
|
"skills",
|
|
22
|
-
"README.md"
|
|
22
|
+
"README.md",
|
|
23
|
+
"schema.json"
|
|
23
24
|
],
|
|
24
25
|
"keywords": [
|
|
25
26
|
"zhin",
|
|
@@ -39,13 +40,13 @@
|
|
|
39
40
|
},
|
|
40
41
|
"license": "MIT",
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@zhin.js/core": "1.1.
|
|
43
|
-
"@zhin.js/skill": "1.1.
|
|
43
|
+
"@zhin.js/core": "1.1.46",
|
|
44
|
+
"@zhin.js/skill": "1.1.7"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"typescript": "^6.0.3",
|
|
47
48
|
"vitest": "^4.1.10",
|
|
48
|
-
"zhin.js": "1.1.
|
|
49
|
+
"zhin.js": "1.1.11"
|
|
49
50
|
},
|
|
50
51
|
"repository": {
|
|
51
52
|
"type": "git",
|
|
@@ -82,9 +83,9 @@
|
|
|
82
83
|
"plugins": []
|
|
83
84
|
},
|
|
84
85
|
"peerDependencies": {
|
|
85
|
-
"@zhin.js/command": "^1.1.
|
|
86
|
-
"@zhin.js/middleware": "^1.1.
|
|
87
|
-
"zhin.js": "^1.1.
|
|
86
|
+
"@zhin.js/command": "^1.1.8",
|
|
87
|
+
"@zhin.js/middleware": "^1.1.7",
|
|
88
|
+
"zhin.js": "^1.1.11"
|
|
88
89
|
},
|
|
89
90
|
"peerDependenciesMeta": {
|
|
90
91
|
"@zhin.js/command": {
|
package/plugin.js
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
import { definePlugin } from 'zhin.js';
|
|
3
3
|
import { RepeaterEngine } from "./lib/engine.js";
|
|
4
4
|
import { repeaterEngineToken } from "./lib/runtime.js";
|
|
5
|
-
import { repeaterConfig } from "./lib/config.js";
|
|
6
5
|
export default definePlugin({
|
|
7
6
|
name: 'repeater',
|
|
8
|
-
config: repeaterConfig,
|
|
9
7
|
metadata: {
|
|
10
8
|
displayName: 'Repeater',
|
|
11
9
|
},
|
package/schema.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"properties": {
|
|
5
|
+
"threshold": {
|
|
6
|
+
"type": "number",
|
|
7
|
+
"description": "触发复读的最少人数",
|
|
8
|
+
"default": 3,
|
|
9
|
+
"minimum": 2,
|
|
10
|
+
"maximum": 10,
|
|
11
|
+
"multipleOf": 1,
|
|
12
|
+
"x-zhin-config": {
|
|
13
|
+
"effect": "reload"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"cooldown": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"description": "同一群冷却时间 (ms)",
|
|
19
|
+
"default": 30000,
|
|
20
|
+
"minimum": 5000,
|
|
21
|
+
"maximum": 300000,
|
|
22
|
+
"x-zhin-config": {
|
|
23
|
+
"effect": "reload"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"maxLength": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"description": "消息长度上限",
|
|
29
|
+
"default": 200,
|
|
30
|
+
"minimum": 10,
|
|
31
|
+
"maximum": 1000,
|
|
32
|
+
"multipleOf": 1,
|
|
33
|
+
"x-zhin-config": {
|
|
34
|
+
"effect": "reload"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -6,7 +6,7 @@ export const DEFAULT_REPEATER_CONFIG = Object.freeze({
|
|
|
6
6
|
maxLength: 200,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/** Authoring declaration; scripts/sync-plugin-config-schemas.mjs generates the packaged schema.json for Runtime and Console. */
|
|
10
10
|
export const repeaterConfig = Schema.object({
|
|
11
11
|
threshold: Schema.number().min(2).max(10).step(1).default(DEFAULT_REPEATER_CONFIG.threshold).description('触发复读的最少人数').effect('reload'),
|
|
12
12
|
cooldown: Schema.number().min(5_000).max(300_000).default(DEFAULT_REPEATER_CONFIG.cooldown).description('同一群冷却时间 (ms)').effect('reload'),
|