Skip to content

Commit

Permalink
fix: context menu command identification
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirasaki committed May 23, 2023
1 parent f35c2ed commit 5ad8085
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/classes/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ class CommandBase {
* command.load(filePath, client.container.commands);
* }
*/
load = (filePath, collection = new Collection(), prefix = null) => {
load = (filePath, collection = new Collection()) => {
this.filePath = filePath;
this.setFilePathDetails();
const identifier = `${ prefix ?? '' }${ this.data.name }`;
const identifier = this.data.name;

// Debug Logging - After we set our file path defaults/fallbacks
if (DEBUG_ENABLED === 'true') {
logger.debug(`Loading <${ chalk.cyanBright(this.data.name) }>`);
logger.debug(`Loading <${ chalk.cyanBright(identifier) }>`);
}

// Set the command in our command collection
Expand Down
3 changes: 2 additions & 1 deletion src/context-menus/message/print-embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const { colorResolver } = require('../../util');

module.exports = new MessageContextCommand({
clientPerms: [ 'EmbedLinks' ],
global: true,
enabled: process.env.NODE_ENV !== 'production',
global: false,
cooldown: {
// Use guild type cooldown instead of default member
type: 'guild',
Expand Down
3 changes: 2 additions & 1 deletion src/context-menus/user/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const MAX_ROLE_DISPLAY_LENGTH = 25;

module.exports = new UserContextCommand({
clientPerms: [ 'EmbedLinks' ],
global: true,
enabled: process.env.NODE_ENV !== 'production',
global: false,
cooldown: {
usages: 1,
duration: 5
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ logger.debug(`Start loading User Context Menu Commands... ("${ CONTEXT_MENU_COMM
for (const filePath of getFiles(`${ CONTEXT_MENU_COMMAND_DIR }/user`)) {
try {
const command = require(filePath);
command.load(filePath, contextMenus, 'user-ctx-menu-');
command.load(filePath, contextMenus);
}
catch (err) {
logger.syserr(`Error encountered while loading User Context Menu Command (${ CONTEXT_MENU_COMMAND_DIR }/user), are you sure you're exporting an instance of UserContextCommand?\nCommand: ${ filePath }`);
Expand All @@ -165,7 +165,7 @@ logger.debug(`Start loading Message Context Menu Commands... ("${ CONTEXT_MENU_C
for (const filePath of getFiles(`${ CONTEXT_MENU_COMMAND_DIR }/message`)) {
try {
const command = require(filePath);
command.load(filePath, contextMenus, 'message-ctx-menu-');
command.load(filePath, contextMenus);
}
catch (err) {
logger.syserr(`Error encountered while loading User Context Menu Command (${ CONTEXT_MENU_COMMAND_DIR }/message), are you sure you're exporting an instance of MessageContextCommand?\nCommand: ${ filePath }`);
Expand Down

0 comments on commit 5ad8085

Please sign in to comment.