initplugins inject deps, inconspicuos

This commit is contained in:
Jacob Nguyen
2024-05-20 12:21:18 -05:00
parent 15511a4868
commit e0f6a4cd16
11 changed files with 68 additions and 129 deletions

View File

@@ -1,6 +1,5 @@
import { CommandType, EventType, PluginType } from './structures/enums';
import type { Plugin, PluginResult, EventArgs, CommandArgs, InitArgs } from '../types/core-plugin';
import type { ClientEvents } from 'discord.js';
import { CommandType, PluginType } from './structures/enums';
import type { Plugin, PluginResult, CommandArgs, InitArgs } from '../types/core-plugin';
import { err, ok } from './functions';
export function makePlugin<V extends unknown[]>(
@@ -31,27 +30,7 @@ export function CommandControlPlugin<I extends CommandType>(
) {
return makePlugin(PluginType.Control, execute);
}
/**
* @since 2.5.0
*/
export function EventControlPlugin<I extends EventType>(
execute: (...args: EventArgs<I>) => PluginResult,
) {
return makePlugin(PluginType.Control, execute);
}
/**
* @since 2.5.0
* @Experimental
* A specialized function for creating control plugins with discord.js ClientEvents.
* Will probably be moved one day!
*/
export function DiscordEventControlPlugin<T extends keyof ClientEvents>(
name: T,
execute: (...args: ClientEvents[T]) => PluginResult,
) {
return makePlugin(PluginType.Control, execute);
}
/**
* @since 1.0.0