Commit e50da4dd authored by nanahira's avatar nanahira

improve database detect

parent 323aee36
Pipeline #6336 passed with stages
in 51 seconds
{
"name": "koishi-plugin-thesaurus",
"version": "1.0.3",
"version": "1.0.4",
"description": "Koishi.js chat plugin for https://github.com/Kyomotoi/AnimeThesaurus",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......
......@@ -147,8 +147,8 @@ export class MyPlugin {
async apply(ctx: Context, config: MyPluginConfigLike) {
this.ctx = ctx;
this.config = schemaTransform(MyPluginConfig, config);
ctx.on('connect', () => {
if (ctx.database && this.config.useDatabase) this.useDatabase = true;
ctx.on('service/database', () => {
if (this.config.useDatabase) this.useDatabase = !!ctx.database;
});
ctx.cache.table('thesaurusChatSession', {
maxAge: this.config.chatTimeout,
......
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