mirror of
https://github.com/sern-handler/handler
synced 2026-06-27 18:22:14 +00:00
refact,simplf
This commit is contained in:
@@ -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),
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user