refact,simplf

This commit is contained in:
jacob
2024-05-25 16:22:25 -05:00
parent 12a8f0c5d7
commit fb418c0675
5 changed files with 24 additions and 11 deletions

View File

@@ -37,6 +37,6 @@ export function CommandControlPlugin<I extends CommandType>(
* The object passed into every plugin to control a command's behavior
*/
export const controller = {
next: (val: unknown=undefined) => Ok(val),
next: (val?: Record<string,unknown>) => Ok(val),
stop: (val?: string) => Err(val),
};

View File

@@ -4,7 +4,7 @@ import { CommandType, EventType } from './structures/enums';
const parseParams = (event: { customId: string }, id: string, append: string) => {
const hasSlash = event.customId.indexOf('/')
if(hasSlash === -1) {
return { id:id+append };
return { id:event.customId+append };
}
const baseid = event.customId.substring(0, hasSlash);
const params = event.customId.substring(hasSlash+1);

View File

@@ -6,7 +6,7 @@ import * as Id from './id'
import { Module } from '../types/core-modules';
export const parseCallsite = (site: string) => {
const pathobj = path.parse(site.replace(/file:\\?/, "")
const pathobj = path.posix.parse(site.replace(/file:\\?/, "")
.split(path.sep)
.join(path.posix.sep))
return { name: pathobj.name,

View File

@@ -193,11 +193,11 @@ type CommandModuleNoPlugins = {
[T in CommandType]: Omit<CommandModuleDefs[T], 'plugins' | 'onEvent' | 'meta'>;
};
type EventModulesNoPlugins = {
[T in EventType]: Omit<EventModuleDefs[T], 'plugins' | 'onEvent' | 'meta'> & { once?: boolean };
[T in EventType]: Omit<EventModuleDefs[T], 'plugins' | 'onEvent' | 'meta'> ;
};
export type InputEvent = {
[T in EventType]: EventModulesNoPlugins[T];
[T in EventType]: EventModulesNoPlugins[T] & { once?: boolean };
}[EventType];
export type InputCommand = {