Commit 5c379552 authored by nanahira's avatar nanahira

catchup

parent 2fa4c8ca
This diff is collapsed.
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
"homepage": "https://code.mycard.moe/3rdeye/koishi-plugin-tabulate", "homepage": "https://code.mycard.moe/3rdeye/koishi-plugin-tabulate",
"dependencies": { "dependencies": {
"class-transformer": "^0.4.0", "class-transformer": "^0.4.0",
"koishi-thirdeye": "^4.0.0", "koishi-thirdeye": "^4.2.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"moment": "^2.29.1", "moment": "^2.29.1",
"source-map-support": "^0.5.20" "source-map-support": "^0.5.20"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.0.0-beta.3" "koishi": "^4.0.0-beta.4"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.14.176", "@types/lodash": "^4.14.176",
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,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-beta.3", "koishi": "^4.0.0-beta.4",
"prettier": "^2.4.1", "prettier": "^2.4.1",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"ts-loader": "^9.2.6", "ts-loader": "^9.2.6",
......
...@@ -3,7 +3,7 @@ import { DefineSchema, RegisterSchema } from 'koishi-thirdeye'; ...@@ -3,7 +3,7 @@ import { DefineSchema, RegisterSchema } from 'koishi-thirdeye';
@RegisterSchema() @RegisterSchema()
export class TabulatePluginConfig { export class TabulatePluginConfig {
@DefineSchema({ desc: '比赛的超时时间', default: 7200000 }) @DefineSchema({ description: '比赛的超时时间', default: 7200000 })
saveTime: number; saveTime: number;
} }
......
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
PutOption, PutOption,
CommandOption, CommandOption,
PutArg, PutArg,
OnConnect,
} from 'koishi-thirdeye'; } from 'koishi-thirdeye';
import { Game, ReportScoreResult } from './def/Match'; import { Game, ReportScoreResult } from './def/Match';
import { classToPlain, plainToClass } from 'class-transformer'; import { classToPlain, plainToClass } from 'class-transformer';
...@@ -32,7 +33,7 @@ declare module 'koishi' { ...@@ -32,7 +33,7 @@ declare module 'koishi' {
} }
@KoishiPlugin({ name: 'tabulate', schema: TabulatePluginConfig }) @KoishiPlugin({ name: 'tabulate', schema: TabulatePluginConfig })
export default class TabulatePlugin implements OnApply { export default class TabulatePlugin implements OnApply, OnConnect {
constructor(private ctx: Context, config: TabulatePluginConfigLike) {} constructor(private ctx: Context, config: TabulatePluginConfigLike) {}
async getGames(key: string) { async getGames(key: string) {
...@@ -60,11 +61,10 @@ export default class TabulatePlugin implements OnApply { ...@@ -60,11 +61,10 @@ export default class TabulatePlugin implements OnApply {
@InjectConfig() @InjectConfig()
private config: TabulatePluginConfig; private config: TabulatePluginConfig;
@Inject('cache') @Inject('cache', true)
private cache: Cache; private cache: Cache;
@UseEvent('service/cache') onConnect() {
loadCacheTable() {
this.cache.table('tabulateMatches', { maxAge: this.config.saveTime }); this.cache.table('tabulateMatches', { maxAge: this.config.saveTime });
} }
......
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