Commit 9098b19d authored by nanahira's avatar nanahira

improve useDatabase

parent cd6bbe19
Pipeline #6335 passed with stages
in 1 minute and 59 seconds
This diff is collapsed.
{ {
"name": "koishi-plugin-fortune", "name": "koishi-plugin-fortune",
"version": "2.0.1", "version": "2.1.0",
"description": "Koishi 的算卦插件", "description": "Koishi 的算卦插件",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/src/index.d.ts", "typings": "dist/src/index.d.ts",
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
"source-map-support": "^0.5.20" "source-map-support": "^0.5.20"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.0.0-alpha.8" "koishi": "^4.0.0-alpha.10"
}, },
"devDependencies": { "devDependencies": {
"@stdlib/random-base-mt19937": "^0.0.5", "@stdlib/random-base-mt19937": "^0.0.5",
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.1", "eslint-plugin-prettier": "^3.4.1",
"koishi": "^4.0.0-alpha.8", "koishi": "^4.0.0-alpha.10",
"moment": "^2.29.1", "moment": "^2.29.1",
"mustache": "^4.2.0", "mustache": "^4.2.0",
"prettier": "^2.4.1", "prettier": "^2.4.1",
......
...@@ -46,8 +46,8 @@ export class MyPlugin { ...@@ -46,8 +46,8 @@ export class MyPlugin {
return result; return result;
} }
apply(ctx: Context, config: Config) { apply(ctx: Context, config: Config) {
ctx.on('connect', () => { ctx.on('service/database', () => {
if (ctx.database && this.config.useDatabase) this.useDatabase = true; if (this.config.useDatabase) this.useDatabase = !!ctx.database;
}); });
this.ctx = ctx; this.ctx = ctx;
this.config = Schema.validate(config, this.schema); this.config = Schema.validate(config, this.schema);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment