Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Khaaz/AxonCore into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaaz committed Jul 29, 2020
2 parents e133684 + 52fda11 commit d16e816
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/Core/Command/CommandEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { COMMAND_EXECUTION_TYPES } from '../../Utility/Constants/AxonEnums';
* @prop {GuildConfig} guildConfig - The GuildConfig data-structure with all DB saved settings
* @prop {String} prefix - The prefix used for this command
* @prop {String} command - The full label of the command being executed
* @prop {String} usedCommandLabel - The used label of the command being executed
* @prop {COMMAND_EXECUTION_TYPES} executionType - Execution type: admin, owner, regular
*/
class CommandEnvironment {
Expand All @@ -40,6 +41,7 @@ class CommandEnvironment {
this.prefix = data.prefix || null;

this.command = data.command !== undefined ? data.command.fullLabel : null;
this.usedLabel = null;

this.guildConfig = data.guildConfig || null;

Expand Down Expand Up @@ -96,11 +98,13 @@ class CommandEnvironment {
* Set the command label from the command object
*
* @param {Command} command
* @param {String} usedLabel
* @returns {CommandEnvironment} This CommandEnvironment
* @memberof CommandEnvironment
*/
setCommand(command) {
setCommand(command, usedLabel) {
this.command = command.fullLabel;
this.usedLabel = usedLabel;
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Core/CommandDispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class CommandDispatcher {
if (!command) { // command doesn't exist or not globally enabled
return;
}
env.setCommand(command);
env.setCommand(command, label);
env.resolveArgs(null, args.join(' ') );

/* Send help for the resolved command */
Expand Down
5 changes: 3 additions & 2 deletions types/Core/Command/CommandEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export declare class CommandEnvironment<T extends LibTextableChannel = LibTextab
/** The raw message content */
public raw: string;
public command: string;
public usedLabel: string;
public msg: LibMessage<T>;
public args: string[];
public prefix: string;
Expand Down Expand Up @@ -53,11 +54,11 @@ export declare class CommandEnvironment<T extends LibTextableChannel = LibTextab
public setGuildConfig(guildConfig: GuildConfig): this;

/**
* Set the command lavel from the command object
* Set the command label from the command object
* @returns This CommandEnvironment
* @memberof CommandEnvironment
*/
public setCommand(command: Command): CommandEnvironment;
public setCommand(command: Command, usedLabel: string): CommandEnvironment;

/**
* Resolve the argument from the args string.
Expand Down

0 comments on commit d16e816

Please sign in to comment.