Skip to content

Commit

Permalink
update plugin system (beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
taisan11 committed Oct 17, 2024
1 parent f08f397 commit 0e09e35
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/module/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { config } from "./config";

export async function exic(type: number, data:{name:string,mail:string,message:string}): Promise<{code:number,data:{name:string,mail:string,message:string}}> {
export async function exic(type: 1|2|4|8|16, data:{name:string,mail:string,message:string}): Promise<{code:number,data:{name:string,mail:string,message:string}}> {
// return {code:10,data}
const plugins = config().preference.site.plugins;
if (!plugins) {
Expand Down Expand Up @@ -40,9 +40,22 @@ type PluginInfo = {
version?: string,
};

type main = (type: number, data: { name: string, mail: string, message: string }) => { code: number, data: { name: string, mail: string, message: string } };
type main = (type: 1|2|4|8|16, data: { name: string, mail: string, message: string }) => { code: number, data: { name: string, mail: string, message: string } };
type ConfigType = {
// ConfigTypeで指定する型の内容を定義します
type: string | number | boolean; // 例としてstring, number, boolean型を含める
};

type ConfigList = {
[key: string]: {
ConfigType: ConfigType["type"]; // ConfigTypeで指定された型を使用
default: ConfigType['type']; // ConfigTypeで指定された型を使用
description: string; // 説明文
};
};

export type Plugin = {
PluginInfo: () => PluginInfo,
main: main
ConfigList?: ConfigList
};
7 changes: 7 additions & 0 deletions src/plugin/och_template_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@ export default function och_template_plugin(): Plugin {
},
};
},
ConfigList: {
"aaa":{
ConfigType:"string",
default:"aaa",
description:"aaa"
}
}
};
}

0 comments on commit 0e09e35

Please sign in to comment.