Commit 5c379552 authored by nanahira's avatar nanahira

catchup

parent 2fa4c8ca
This diff is collapsed.
......@@ -3,7 +3,7 @@ import { DefineSchema, RegisterSchema } from 'koishi-thirdeye';
@RegisterSchema()
export class TabulatePluginConfig {
@DefineSchema({ desc: '比赛的超时时间', default: 7200000 })
@DefineSchema({ description: '比赛的超时时间', default: 7200000 })
saveTime: number;
}
......
......@@ -14,6 +14,7 @@ import {
PutOption,
CommandOption,
PutArg,
OnConnect,
} from 'koishi-thirdeye';
import { Game, ReportScoreResult } from './def/Match';
import { classToPlain, plainToClass } from 'class-transformer';
......@@ -32,7 +33,7 @@ declare module 'koishi' {
}
@KoishiPlugin({ name: 'tabulate', schema: TabulatePluginConfig })
export default class TabulatePlugin implements OnApply {
export default class TabulatePlugin implements OnApply, OnConnect {
constructor(private ctx: Context, config: TabulatePluginConfigLike) {}
async getGames(key: string) {
......@@ -60,11 +61,10 @@ export default class TabulatePlugin implements OnApply {
@InjectConfig()
private config: TabulatePluginConfig;
@Inject('cache')
@Inject('cache', true)
private cache: Cache;
@UseEvent('service/cache')
loadCacheTable() {
onConnect() {
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