Skip to content

Commit

Permalink
inlineinignsd
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoobes committed May 24, 2024
1 parent 86dd0cd commit 76d9db7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/core/create-plugins.ts
Original file line number Diff line number Diff line change
@@ -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<V extends unknown[]>(
type: PluginType,
Expand Down Expand Up @@ -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: ok,
stop: err,
next: (val: unknown=undefined) => Ok(val),
stop: (val?: string) => Err(val),
};
5 changes: 2 additions & 3 deletions src/core/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T,V>
(arr: Array<{ type: PluginType }> = []): [T[], V[]] {
Expand Down
2 changes: 1 addition & 1 deletion src/core/module-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/core/structures/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -29,7 +29,7 @@ export class Context extends CoreContext<Message, ChatInputCommandInteraction> {
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);
Expand Down

0 comments on commit 76d9db7

Please sign in to comment.