mirror of
https://github.com/sern-handler/cli
synced 2026-06-06 01:16:53 +00:00
eol
This commit is contained in:
@@ -174,21 +174,22 @@ export async function build(options: Record<string, any>) {
|
||||
${commandsPaths.map((imp, i) => {
|
||||
if(i === 0) {
|
||||
return `if(interaction.data.name === "${p.parse(imp).name}") {
|
||||
const success = await applyPlugins(${p.parse(imp).name});
|
||||
const data = createContext(interaction)
|
||||
const success = await applyPlugins(${p.parse(imp).name}, data);
|
||||
if(success) {
|
||||
await ${p.parse(imp).name}.execute();
|
||||
await ${p.parse(imp).name}.execute(data);
|
||||
}
|
||||
}`
|
||||
}
|
||||
return `else if(interaction.data.name === "${p.parse(imp).name}" ) {
|
||||
const success = await applyPlugins(${p.parse(imp).name});
|
||||
if(success) {
|
||||
await ${p.parse(imp).name}.execute();
|
||||
}
|
||||
}`
|
||||
}).join("\n")}
|
||||
`);
|
||||
|
||||
const data = createContext(interaction)
|
||||
const success = await applyPlugins(${p.parse(imp).name}, data);
|
||||
if(success) {
|
||||
await ${p.parse(imp).name}.execute(data);
|
||||
}
|
||||
}`
|
||||
}).join("\n")}`.trim());
|
||||
|
||||
await writeFile("./dist/out.js", importedModulesTemplate);
|
||||
} else {
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ class JsonResponse extends Response {
|
||||
super(jsonBody, init);
|
||||
}
|
||||
}
|
||||
|
||||
function createContext(rawcontext) {
|
||||
return rawcontext
|
||||
}
|
||||
async function executeModule(
|
||||
emitter,
|
||||
logger,
|
||||
@@ -40,7 +42,7 @@ async function applyPlugins(module, payload) {
|
||||
let success = true;
|
||||
for (const plg of module.onEvent){
|
||||
const res = await plg.execute(payload);
|
||||
if(!res.ok) {
|
||||
if(!res.isOk()) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user