Commit 1376e58f authored by nanahira's avatar nanahira

Migrate schema to Config

parent aac621d4
import 'source-map-support/register'; import 'source-map-support/register';
import type { Context } from 'koishi'; import type { Context } from 'koishi';
import { Config, MyPlugin } from './plugin'; import { PluginConfig, MyPlugin } from './plugin';
export { Config } from './plugin'; export * from './plugin';
export const name = 'limit-help'; export const name = 'limit-help';
const plugin = new MyPlugin(); const plugin = new MyPlugin();
export const schema = plugin.schema; export const Config = plugin.schema;
export function apply(ctx: Context, config: Config) { export function apply(ctx: Context, config: PluginConfig) {
ctx.plugin(plugin, config); ctx.plugin(plugin, config);
} }
...@@ -20,16 +20,16 @@ export interface Selection extends BaseSelection { ...@@ -20,16 +20,16 @@ export interface Selection extends BaseSelection {
$not?: Selection; $not?: Selection;
} }
export type Config = Selection; export type PluginConfig = Selection;
export class MyPlugin { export class MyPlugin {
config: Config; config: PluginConfig;
ctx: Context; ctx: Context;
name = 'limit-help-main'; name = 'limit-help-main';
schema: Schema<Selection> = Schema.any().description('帮助作用域').default({ schema: Schema<Selection> = Schema.any().description('帮助作用域').default({
$user: '10000', $user: '10000',
}); });
apply(ctx: Context, config: Config) { apply(ctx: Context, config: PluginConfig) {
this.ctx = ctx; this.ctx = ctx;
this.config = config; this.config = config;
this.disableHelp(); this.disableHelp();
......
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