diff --git a/src/handler/structures/commands/command-options.ts b/src/handler/structures/commands/command-options.ts index cb8ade8..7874b3b 100644 --- a/src/handler/structures/commands/command-options.ts +++ b/src/handler/structures/commands/command-options.ts @@ -1,5 +1,5 @@ import type { ApplicationCommandOptionData } from 'discord.js'; -import type { CommandType } from '../sern'; +import type { CommandType } from '../../sern'; /** * An object that gets imported and acts as a command. @@ -15,7 +15,6 @@ interface CommandOptions { alias : string[] | [], options?: ApplicationCommandOptionData[], name? : string | undefined - } export default CommandOptions; diff --git a/src/handler/structures/commands/command.ts b/src/handler/structures/commands/command.ts index ccb461b..8c096d9 100644 --- a/src/handler/structures/commands/command.ts +++ b/src/handler/structures/commands/command.ts @@ -10,29 +10,29 @@ import type CommandOptions from "./command-options"; export abstract class Command { - protected _name? : string | undefined; - protected _ctx : Context = new Context( None, None ); - protected _commandType : CommandType; - protected _options : ApplicationCommandOptionData[] | undefined; - protected _alias : string[] | undefined; - protected constructor ( + private name? : string | undefined; + private ctx : Context = new Context( None, None ); + private commandType : CommandType; + private options : ApplicationCommandOptionData[] | undefined; + private alias : string[] | undefined; + private constructor ( { name, commandType, options, alias } : CommandOptions ) { - this._name = name; - this._commandType = commandType; + this.name = name; + this.commandType = commandType; switch ( commandType ) { case CommandType.TEXT : { - this._options = undefined; - this._alias = alias; + this.options = undefined; + this.alias = alias; } break; case CommandType.SLASH : { if(alias.length < 0) throw Error(SernError.NO_ALIAS); - this._options = options; + this.options = options; } break; case CommandType.BOTH : { - this._options = options; - this._alias = alias; - } break; + this.options = options; + this.alias = alias; + } break } @@ -40,9 +40,9 @@ export abstract class Command { abstract execute ( args: Ok ) : Awaitable; abstract parse? ( args: Arg ) : Utils.ArgType; - public setCtx ( context: Context ) { this._ctx = context; } - public getName () { return this._name; } - public getCommandType () { return this._commandType; } - public getOptions() { return this._options; } - public getAlias() { return this._alias } + public setCtx ( context: Context ) { this.ctx = context; } + public getName () { return this.name; } + public getCommandType () { return this.commandType; } + public getOptions() { return this.options; } + public getAlias() { return this.alias } }