added method templates

This commit is contained in:
mmacierzanka committed 2021-09-08 19:22:33 +02:00
1 parent 037a4a5999
commit 07de442c01
2 files changed
+26 -2

No files matched your search

+24
View File
@@ -1,4 +1,9 @@
import { Interaction, Message } from "discord.js";
import { BaseCommand } from "./BaseCommand.js";
import { ChatCommand } from "./ChatCommand.js";
import { MessageCommand } from "./MessageCommand.js";
import { CommandType } from "./types/BaseCommand.js";
import { CommandInteractionData } from "./types/commands.js";
export class CommandManager {
private readonly _commands: BaseCommand[] = [];
@@ -9,4 +14,23 @@ export class CommandManager {
this.prefix = prefix;
this.argumentSeparator = argSep || ",";
}
public add(command: BaseCommand): void {}
public get<T extends CommandType>(
q: string,
t?: T
): (T extends "CHAT" ? ChatCommand : T extends "MESSAGE" ? MessageCommand : T extends "USER" ? MessageCommand : BaseCommand) | null {
return null;
}
public list<T extends CommandType>(
filter?: T
): T extends "CHAT" ? ChatCommand[] : T extends "MESSAGE" ? MessageCommand[] : T extends "USER" ? MessageCommand[] : BaseCommand[] {
return [];
}
public fetch<T extends Interaction | Message>(i: T): CommandInteractionData<T extends Interaction ? BaseCommand : ChatCommand> | null {
return null;
}
}
+2 -2
View File
@@ -8,7 +8,7 @@ export type CommandStructure<T> = T extends "MESSAGE" ? MessageCommand : T exten
export type CommandResolvable = BaseCommand | ChatCommand | MessageCommand | UserCommand;
export interface CommandInteractionData {
command: BaseCommand;
export interface CommandInteractionData<T extends CommandResolvable> {
command: T;
parameters: InputParameter[];
}