Commit 803fb563 authored by nanahira's avatar nanahira

catchup

parent f0e851f6
This diff is collapsed.
......@@ -7,22 +7,22 @@ import path from 'path';
@RegisterSchema()
export class HisoutensokuJammerPluginConfig {
@DefineSchema({ desc: '干扰时间', default: 10000 })
@DefineSchema({ description: '干扰时间', default: 10000 })
attackTimeout: number;
@DefineSchema({ desc: 'IP 白名单', default: [], type: 'string' })
@DefineSchema({ description: 'IP 白名单', default: [], type: 'string' })
addressWhitelist: string[];
@DefineSchema({ desc: '开启文字识别', default: false })
@DefineSchema({ description: '开启文字识别', default: false })
ocr: boolean;
@DefineSchema({ desc: '模型语言', default: 'eng' })
@DefineSchema({ description: '模型语言', default: 'eng' })
ocrLanguage: string;
@DefineSchema({ type: 'object', allowUnknown: true })
@DefineSchema({ type: 'object' })
ocrExtraOptions: Partial<Tesseract.WorkerOptions>;
@DefineSchema({ type: 'object', allowUnknown: true })
@DefineSchema({ type: 'object' })
ocrExtraParameters: Partial<Tesseract.WorkerParams>;
async loadOcr() {
......
......@@ -11,6 +11,7 @@ import {
InjectLogger,
Inject,
UseEvent,
OnConnect,
} from 'koishi-thirdeye';
import { Attacker } from './attacker';
import moment from 'moment';
......@@ -38,7 +39,7 @@ const PROTOCOL_BASE64 = 'base64://';
name: 'hisoutensoku-jammer',
schema: HisoutensokuJammerPluginConfig,
})
export default class HisoutensokuJammerPlugin {
export default class HisoutensokuJammerPlugin implements OnConnect {
constructor(
private ctx: Context,
config: HisoutensokuJammerPluginConfigLike,
......@@ -47,11 +48,10 @@ export default class HisoutensokuJammerPlugin {
@InjectLogger()
private log: Logger;
@Inject('cache')
@Inject('cache', true)
private cache: Cache;
@UseEvent('service/cache')
initializeCacheTable() {
onConnect() {
this.cache.table('lastMessages', { maxAge: 600000 });
}
......
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