async handle(context, prefix) {
        try {
            // To search a slash command, we need to add the prefix '/' (like: /{slashCommandName})
            const command = this.get(
                context instanceof CommandInteraction
                    ? `/${context.commandName}`
                    : context.content.slice(prefix?.length).split(' ')[0],
            );
            // First validation is only for channel commands.
            if ((context instanceof Message && !context.content.startsWith(prefix)) || !command) return;

            if (!command.execute)
                return this.client.logger.error(
                    new Error(`Command ${command.name} don't have a execute function. (${command.path})`),
                    'CommandManager',
                );

            this.#handler.run(command, context, prefix);
        } catch (error) {
            context.reply({ content: 'Un error ha ocurrido.', attemptReply: true });

            this.client.logger.error(error, 'CommandManager');
        }
    }
/**
     * Handle channel and interaction commands.
     * @param { (Message | CommandInteraction) } context - Message or CommandInteraction.
     * @param { string } prefix - The prefix what was used with the command.
     */
Handle channel and interaction commands.
@param { (Message | CommandInteraction) } context - Message or CommandInteraction.
@param { string } prefix - The prefix what was used with the command.
Handle channel and interaction commands . @param { ( Message | CommandInteraction ) } context - Message or CommandInteraction . @param { string } prefix - The prefix what was used with the command .
async handle(context, prefix) {
        try {
            const command = this.get(
                context instanceof CommandInteraction
                    ? `/${context.commandName}`
                    : context.content.slice(prefix?.length).split(' ')[0],
            );
            if ((context instanceof Message && !context.content.startsWith(prefix)) || !command) return;
            if (!command.execute)
                return this.client.logger.error(
                    new Error(`Command ${command.name} don't have a execute function. (${command.path})`),
                    'CommandManager',
                );
            this.#handler.run(command, context, prefix);
        } catch (error) {
            context.reply({ content: 'Un error ha ocurrido.', attemptReply: true });
            this.client.logger.error(error, 'CommandManager');
        }
    }
async handle ( context , prefix ) { try { const command = this . get ( context instanceof CommandInteraction ? ` ${ context . commandName } ` : context . content . slice ( prefix ?. length ) . split ( ' ' ) [ 0 ] , ) ; if ( ( context instanceof Message && ! context . content . startsWith ( prefix ) ) || ! command ) return ; if ( ! command . execute ) return this . client . logger . error ( new Error ( ` ${ command . name } ${ command . path } ` ) , 'CommandManager' , ) ; this . #handler . run ( command , context , prefix ) ; } catch ( error ) { context . reply ( { content : 'Un error ha ocurrido.' , attemptReply : true } ) ; this . client . logger . error ( error , 'CommandManager' ) ; } }
Handle channel and interaction commands.
Handle channel and interaction commands .
// To search a slash command, we need to add the prefix '/' (like: /{slashCommandName}) // First validation is only for channel commands.