Giter VIP home page Giter VIP logo

Comments (5)

dragonfire535 avatar dragonfire535 commented on June 1, 2024

???

from commando.

Zekareisoujin avatar Zekareisoujin commented on June 1, 2024

This might be the issue:

	 * Parses a message to find details about command usage in it
	 * @param {Message} message - The message
	 * @return {?CommandMessage}
	 * @private
	 */
	parseMessage(message) {
		// Find the command to run by patterns
		for(const command of this.registry.commands) {
			if(!command.patterns) continue;
			for(const pattern of command.patterns) {
				const matches = pattern.exec(message.content);
				if(matches) return new CommandMessage(message, command, null, matches);
			}
		}

		// Find the command to run with default command handling
		const prefix = message.guild ? message.guild.commandPrefix : this.client.commandPrefix;
		if(!this._commandPatterns[prefix]) this.buildCommandPattern(prefix);
		let cmdMsg = this.matchDefault(message, this._commandPatterns[prefix], 2);
		if(!cmdMsg && !message.guild && !this.client.options.selfbot) cmdMsg = this.matchDefault(message, /^([^\s]+)/i);
		return cmdMsg;
	}

const command of this.registry.commands is an array, and thus if(!command.patterns) continue; will always holds true, skipping the rest of the logic.

from commando.

iCrawl avatar iCrawl commented on June 1, 2024

? Skip which logic. The logic for the patterns? continue; wont effect the code outside of the loop.

from commando.

Zekareisoujin avatar Zekareisoujin commented on June 1, 2024

Last I check, the command object in for (const command of this.registry.commands) is of this structure:

[ 'help',
 HelpCommand {
...
}]

Which means !command.pattern always returns true. Just FYI I'm still using discord.js 11.1.0 & discord.js-commando 0.9.0.

from commando.

Gawdl3y avatar Gawdl3y commented on June 1, 2024

Thanks for catching that. Fixed in de635ac.

from commando.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.