From 6abdef1def8529a893b2d7eb65f91310344a8441 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 26 Mar 2020 17:03:04 +0800 Subject: [PATCH 1/4] fix(core): fix shouldFetchUsage --- packages/koishi-core/src/command.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/koishi-core/src/command.ts b/packages/koishi-core/src/command.ts index d1942c1da6..055d7e8ff5 100644 --- a/packages/koishi-core/src/command.ts +++ b/packages/koishi-core/src/command.ts @@ -98,9 +98,7 @@ export class Command { const { maxUsage, minInterval, authority } = command.config let shouldFetchAuthority = !userFields.has('authority') && authority > 0 - let shouldFetchUsage = !userFields.has('usage') && ( - typeof maxUsage === 'number' && maxUsage < Infinity || - typeof minInterval === 'number' && minInterval > 0) + let shouldFetchUsage = !(userFields.has('usage') || !maxUsage && !minInterval) for (const option of command._options) { if (option.camels[0] in options) { if (option.authority > 0) shouldFetchAuthority = true From 08bf402025e518b5355f51262246a5b84823b096 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 26 Mar 2020 17:05:01 +0800 Subject: [PATCH 2/4] fix(core): fix ws server broken by cqhttp 4.14 --- packages/koishi-core/src/server.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/koishi-core/src/server.ts b/packages/koishi-core/src/server.ts index 00b7f311a1..ef9290340d 100644 --- a/packages/koishi-core/src/server.ts +++ b/packages/koishi-core/src/server.ts @@ -326,7 +326,6 @@ export class WsClient extends Server { if (error) reject(error) }) - let resolved = false this.socket.on('message', (data) => { data = data.toString() this.debug('receive', data) @@ -337,19 +336,13 @@ export class WsClient extends Server { return reject(new Error(data)) } - if (!resolved) { - resolved = true - this.debug('connect to ws server:', this.app.options.server) - resolve() - } - if ('post_type' in parsed) { const meta = this.prepareMeta(parsed) if (meta) this.dispatchMeta(meta) - } else { - if (parsed.echo === -1) { - this.version = camelCase(parsed.data) - } + } else if (parsed.echo === -1) { + this.version = camelCase(parsed.data) + this.debug('connect to ws server:', this.app.options.server) + resolve() this._listeners[parsed.echo]?.(parsed) } }) From 6e6ff0673c888b6e653bd77c7a95ed769f29475e Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 26 Mar 2020 17:24:30 +0800 Subject: [PATCH 3/4] chore: bump version --- packages/database-level/package.json | 6 +++--- packages/database-memory/package.json | 4 ++-- packages/database-mysql/package.json | 4 ++-- packages/database-sqlite/package.json | 6 +++--- packages/koishi-cli/package.json | 8 ++++---- packages/koishi-core/package.json | 6 +++--- packages/plugin-common/package.json | 8 ++++---- packages/plugin-nlp/package.json | 6 +++--- packages/plugin-recorder/package.json | 6 +++--- packages/plugin-schedule/package.json | 10 +++++----- packages/plugin-teach/package.json | 10 +++++----- packages/test-utils/package.json | 4 ++-- 12 files changed, 39 insertions(+), 39 deletions(-) diff --git a/packages/database-level/package.json b/packages/database-level/package.json index 6969bcb148..5d1d3d5d0b 100644 --- a/packages/database-level/package.json +++ b/packages/database-level/package.json @@ -1,7 +1,7 @@ { "name": "koishi-database-level", "description": "Leveldb support for Koishi", - "version": "1.1.6", + "version": "1.1.7", "main": "dist/index.js", "files": [ "dist" @@ -33,10 +33,10 @@ "leveldb" ], "devDependencies": { - "koishi-test-utils": "^3.2.1" + "koishi-test-utils": "^3.2.2" }, "peerDependencies": { - "koishi-core": "^1.11.1" + "koishi-core": "^1.11.2" }, "dependencies": { "@types/leveldown": "^4.0.2", diff --git a/packages/database-memory/package.json b/packages/database-memory/package.json index e01e099146..46a701858d 100644 --- a/packages/database-memory/package.json +++ b/packages/database-memory/package.json @@ -1,7 +1,7 @@ { "name": "koishi-database-memory", "description": "An in-memory database implementation for Koishi", - "version": "1.1.6", + "version": "1.1.7", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/koishijs/koishi/tree/master/packages/database-memory#readme", "peerDependencies": { - "koishi-core": "^1.11.1" + "koishi-core": "^1.11.2" }, "dependencies": { "koishi-utils": "^1.0.4" diff --git a/packages/database-mysql/package.json b/packages/database-mysql/package.json index 5fe40353d2..a35faf8fc0 100644 --- a/packages/database-mysql/package.json +++ b/packages/database-mysql/package.json @@ -1,7 +1,7 @@ { "name": "koishi-database-mysql", "description": "MySQL support for Koishi", - "version": "1.1.6", + "version": "1.1.7", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -35,7 +35,7 @@ "@types/mysql": "^2.15.9" }, "peerDependencies": { - "koishi-core": "^1.11.1" + "koishi-core": "^1.11.2" }, "dependencies": { "koishi-utils": "^1.0.4", diff --git a/packages/database-sqlite/package.json b/packages/database-sqlite/package.json index 54fe50304d..c2e656c4f6 100644 --- a/packages/database-sqlite/package.json +++ b/packages/database-sqlite/package.json @@ -1,6 +1,6 @@ { "name": "koishi-database-sqlite", - "version": "1.0.0-alpha.12", + "version": "1.0.0-alpha.13", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -22,10 +22,10 @@ "homepage": "https://github.com/koishijs/koishi/tree/master/packages/database-sqlite#readme", "devDependencies": { "@types/sqlite3": "^3.1.6", - "koishi-test-utils": "^3.2.1" + "koishi-test-utils": "^3.2.2" }, "peerDependencies": { - "koishi-core": "^1.11.1" + "koishi-core": "^1.11.2" }, "dependencies": { "koishi-utils": "^1.0.4", diff --git a/packages/koishi-cli/package.json b/packages/koishi-cli/package.json index f3caf0508e..8f34509da1 100644 --- a/packages/koishi-cli/package.json +++ b/packages/koishi-cli/package.json @@ -1,7 +1,7 @@ { "name": "koishi", "description": "A QQ bot framework based on CQHTTP", - "version": "1.11.1", + "version": "1.11.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -38,9 +38,9 @@ "cac": "^6.5.7", "js-yaml": "^3.13.1", "kleur": "^3.0.3", - "koishi-core": "^1.11.1", - "koishi-plugin-common": "^2.1.7", - "koishi-plugin-schedule": "^1.0.12", + "koishi-core": "^1.11.2", + "koishi-plugin-common": "^2.1.8", + "koishi-plugin-schedule": "^1.0.13", "koishi-utils": "^1.0.4", "prompts": "^2.3.1" } diff --git a/packages/koishi-core/package.json b/packages/koishi-core/package.json index afc4b092d5..76362a6426 100644 --- a/packages/koishi-core/package.json +++ b/packages/koishi-core/package.json @@ -1,7 +1,7 @@ { "name": "koishi-core", "description": "Core features for Koishi", - "version": "1.11.1", + "version": "1.11.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -35,8 +35,8 @@ "@types/debug": "^4.1.5", "@types/ws": "^7.2.2", "get-port": "^5.1.1", - "koishi-database-memory": "^1.1.6", - "koishi-test-utils": "^3.2.1" + "koishi-database-memory": "^1.1.7", + "koishi-test-utils": "^3.2.2" }, "dependencies": { "axios": "^0.19.2", diff --git a/packages/plugin-common/package.json b/packages/plugin-common/package.json index dd65969ce3..b73b3698a5 100644 --- a/packages/plugin-common/package.json +++ b/packages/plugin-common/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-common", "description": "Common plugins for Koishi", - "version": "2.1.7", + "version": "2.1.8", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -28,11 +28,11 @@ "plugin" ], "devDependencies": { - "koishi-database-memory": "^1.1.6", - "koishi-test-utils": "^3.2.1" + "koishi-database-memory": "^1.1.7", + "koishi-test-utils": "^3.2.2" }, "dependencies": { - "koishi-core": "^1.11.1", + "koishi-core": "^1.11.2", "koishi-utils": "^1.0.4" } } diff --git a/packages/plugin-nlp/package.json b/packages/plugin-nlp/package.json index df82f0d7d6..c4b3bdc676 100644 --- a/packages/plugin-nlp/package.json +++ b/packages/plugin-nlp/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-nlp", "description": "Natural Language Processor for Koishi", - "version": "1.0.7", + "version": "1.0.8", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -30,10 +30,10 @@ "jieba" ], "devDependencies": { - "koishi-test-utils": "^3.2.1" + "koishi-test-utils": "^3.2.2" }, "dependencies": { - "koishi-core": "^1.11.1", + "koishi-core": "^1.11.2", "koishi-utils": "^1.0.4", "nodejieba": "^2.4.1" } diff --git a/packages/plugin-recorder/package.json b/packages/plugin-recorder/package.json index 61e37cc802..a902f5a74d 100644 --- a/packages/plugin-recorder/package.json +++ b/packages/plugin-recorder/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-recorder", "description": "Save Chat Records for Koishi", - "version": "1.0.0-alpha.10", + "version": "1.0.0-alpha.11", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -31,10 +31,10 @@ ], "devDependencies": { "del": "^5.1.0", - "koishi-test-utils": "^3.2.1" + "koishi-test-utils": "^3.2.2" }, "dependencies": { - "koishi-core": "^1.11.1", + "koishi-core": "^1.11.2", "koishi-utils": "^1.0.4" } } diff --git a/packages/plugin-schedule/package.json b/packages/plugin-schedule/package.json index 65b6a2fd80..73df0039b8 100644 --- a/packages/plugin-schedule/package.json +++ b/packages/plugin-schedule/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-schedule", "description": "Schedule plugin for Koishi", - "version": "1.0.12", + "version": "1.0.13", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -31,12 +31,12 @@ ], "devDependencies": { "@types/ms": "^0.7.31", - "koishi-database-level": "^1.1.6", - "koishi-database-mysql": "^1.1.6", - "koishi-test-utils": "^3.2.1" + "koishi-database-level": "^1.1.7", + "koishi-database-mysql": "^1.1.7", + "koishi-test-utils": "^3.2.2" }, "dependencies": { - "koishi-core": "^1.11.1", + "koishi-core": "^1.11.2", "koishi-utils": "^1.0.4", "ms": "^2.1.2" } diff --git a/packages/plugin-teach/package.json b/packages/plugin-teach/package.json index 4ed7492b9d..dc02427f52 100644 --- a/packages/plugin-teach/package.json +++ b/packages/plugin-teach/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-teach", "description": "Teach plugin for Koishi", - "version": "0.1.21", + "version": "0.1.22", "main": "dist/index.js", "typings": "dist/index.d.ts", "author": "Shigma <1700011071@pku.edu.cn>", @@ -31,12 +31,12 @@ "conversation" ], "devDependencies": { - "koishi-database-level": "^1.1.6", - "koishi-database-mysql": "^1.1.6", - "koishi-test-utils": "^3.2.1" + "koishi-database-level": "^1.1.7", + "koishi-database-mysql": "^1.1.7", + "koishi-test-utils": "^3.2.2" }, "dependencies": { - "koishi-core": "^1.11.1", + "koishi-core": "^1.11.2", "koishi-utils": "^1.0.4" } } diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index d9191c61aa..2d46f4705e 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -1,7 +1,7 @@ { "name": "koishi-test-utils", "description": "Test utilities for Koishi", - "version": "3.2.1", + "version": "3.2.2", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -43,7 +43,7 @@ "axios": "^0.19.2", "debug": "^4.1.1", "get-port": "^5.1.1", - "koishi-core": "^1.11.1", + "koishi-core": "^1.11.2", "koishi-utils": "^1.0.4" } } From fe43409ba4502f5d6f37285c8a53dcf461a4d157 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 26 Mar 2020 17:26:03 +0800 Subject: [PATCH 4/4] dep: cac: ^6.5.7 -> 6.5.8, prompts: ^2.3.1 -> 2.3.2 --- package.json | 18 +++++++++--------- packages/koishi-cli/package.json | 6 +++--- packages/koishi-core/package.json | 2 +- packages/test-utils/package.json | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 2026a9e44c..854351c6c1 100644 --- a/package.json +++ b/package.json @@ -23,37 +23,37 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@octokit/rest": "^17.1.0", + "@octokit/rest": "^17.1.3", "@types/cross-spawn": "^6.0.1", "@types/fs-extra": "^8.1.0", "@types/jest": "^25.1.4", "@types/node": "^13.9.1", "@types/semver": "^7.1.0", - "@typescript-eslint/eslint-plugin": "^2.23.0", - "@typescript-eslint/parser": "^2.23.0", - "cac": "^6.5.7", + "@typescript-eslint/eslint-plugin": "^2.25.0", + "@typescript-eslint/parser": "^2.25.0", + "cac": "^6.5.8", "cross-spawn": "^7.0.1", "del": "^5.1.0", "eslint": "^6.8.0", - "eslint-config-standard": "^14.1.0", + "eslint-config-standard": "^14.1.1", "eslint-plugin-import": "^2.20.1", "eslint-plugin-jest": "^23.8.2", "eslint-plugin-node": "^11.0.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.1", "express": "^4.17.1", - "fs-extra": "^8.1.0", + "fs-extra": "^9.0.0", "globby": "^11.0.0", - "jest": "^25.1.0", + "jest": "^25.2.1", "kleur": "^3.0.3", "latest-version": "^5.1.0", "open": "^7.0.3", "ora": "^4.0.3", "p-map": "^4.0.0", - "prompts": "^2.3.1", + "prompts": "^2.3.2", "semver": "^7.1.3", "ts-jest": "^25.2.1", - "ts-node": "^8.6.2", + "ts-node": "^8.8.1", "typescript": "^3.8.3" } } diff --git a/packages/koishi-cli/package.json b/packages/koishi-cli/package.json index 8f34509da1..611277b1b5 100644 --- a/packages/koishi-cli/package.json +++ b/packages/koishi-cli/package.json @@ -31,17 +31,17 @@ "koishi" ], "devDependencies": { - "@types/js-yaml": "^3.12.2", + "@types/js-yaml": "^3.12.3", "@types/prompts": "^2.0.5" }, "dependencies": { - "cac": "^6.5.7", + "cac": "^6.5.8", "js-yaml": "^3.13.1", "kleur": "^3.0.3", "koishi-core": "^1.11.2", "koishi-plugin-common": "^2.1.8", "koishi-plugin-schedule": "^1.0.13", "koishi-utils": "^1.0.4", - "prompts": "^2.3.1" + "prompts": "^2.3.2" } } diff --git a/packages/koishi-core/package.json b/packages/koishi-core/package.json index 76362a6426..93dc617791 100644 --- a/packages/koishi-core/package.json +++ b/packages/koishi-core/package.json @@ -33,7 +33,7 @@ ], "devDependencies": { "@types/debug": "^4.1.5", - "@types/ws": "^7.2.2", + "@types/ws": "^7.2.3", "get-port": "^5.1.1", "koishi-database-memory": "^1.1.7", "koishi-test-utils": "^3.2.2" diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 2d46f4705e..1b419c582d 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -33,7 +33,7 @@ "utilities" ], "peerDependencies": { - "jest": "^25.1.0" + "jest": "^25.2.1" }, "devDependencies": { "@types/debug": "^4.1.5",