refactor: minor (#347)

* some refactoring

* accidental merge

* refactor: ensure all asserts have error message to avoid cryptic messages

* general refactoring

* move controller to create-plugin
This commit is contained in:
Jacob Nguyen
2024-01-02 13:04:59 -06:00
committed by GitHub
parent b962dae36c
commit b0399f9507
19 changed files with 54 additions and 98 deletions

View File

@@ -1,6 +1,7 @@
import { CommandType, EventType, PluginType } from './structures';
import type { Plugin, PluginResult, EventArgs, CommandArgs } from '../types/core-plugin';
import type { ClientEvents } from 'discord.js';
import { err, ok } from './functions';
export function makePlugin<V extends unknown[]>(
type: PluginType,
@@ -60,3 +61,12 @@ export function DiscordEventControlPlugin<T extends keyof ClientEvents>(
) {
return makePlugin(PluginType.Control, execute);
}
/**
* @since 1.0.0
* The object passed into every plugin to control a command's behavior
*/
export const controller = {
next: ok,
stop: err,
};