diff --git a/src/core/create-plugins.ts b/src/core/create-plugins.ts index e65b097d..089d5aa1 100644 --- a/src/core/create-plugins.ts +++ b/src/core/create-plugins.ts @@ -1,6 +1,6 @@ import { CommandType, PluginType } from './structures/enums'; import type { Plugin, PluginResult, CommandArgs, InitArgs } from '../types/core-plugin'; -import { err, ok } from './functions'; +import { Err, Ok } from 'ts-results-es'; export function makePlugin( type: PluginType, @@ -37,6 +37,6 @@ export function CommandControlPlugin( * The object passed into every plugin to control a command's behavior */ export const controller = { - next: ok, - stop: err, + next: (val: unknown=undefined) => Ok(val), + stop: (val?: string) => Err(val), }; diff --git a/src/core/functions.ts b/src/core/functions.ts index 520e0010..85cfd8bb 100644 --- a/src/core/functions.ts +++ b/src/core/functions.ts @@ -10,12 +10,11 @@ import type { AutocompleteInteraction } from 'discord.js'; import { ApplicationCommandOptionType, InteractionType } from 'discord.js'; -import { PayloadType, PluginType } from './structures/enums'; +import { PluginType } from './structures/enums'; import assert from 'assert'; import type { Payload } from '../types/utility'; -export const ok = (val: unknown=undefined) => Ok(val); -export const err = (val?: string) => Err(val); + export function partitionPlugins (arr: Array<{ type: PluginType }> = []): [T[], V[]] { diff --git a/src/core/module-loading.ts b/src/core/module-loading.ts index dd4ef4f3..e4875c5c 100644 --- a/src/core/module-loading.ts +++ b/src/core/module-loading.ts @@ -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, diff --git a/src/core/structures/context.ts b/src/core/structures/context.ts index e19055d0..53069ea7 100644 --- a/src/core/structures/context.ts +++ b/src/core/structures/context.ts @@ -11,7 +11,7 @@ import type { import { CoreContext } from '../structures/core-context'; import { Result, Ok, Err } from 'ts-results-es'; import * as assert from 'assert'; -import { ReplyOptions } from '../../types/utility'; +import type { ReplyOptions } from '../../types/utility'; function fmt(msg: string, prefix?: string): string[] { if(!prefix) throw Error("Unable to parse message without prefix"); @@ -29,7 +29,7 @@ export class Context extends CoreContext { return this.interaction.options; } //TODO - args(type: 'message'|'interaction', parser?: Function) { + args(type: 'message'|'interaction') { switch(type) { case 'message': { const [, ...rest] = fmt(this.message.content, this.prefix);