mirror of
https://github.com/sern-handler/handler
synced 2026-06-25 17:22:15 +00:00
inlineinignsd
This commit is contained in:
@@ -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,
|
||||
@@ -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),
|
||||
};
|
||||
|
||||
@@ -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[]] {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<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);
|
||||
|
||||
Reference in New Issue
Block a user