Comments (5)
???
from commando.
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.
? Skip which logic. The logic for the patterns? continue;
wont effect the code outside of the loop.
from commando.
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.
Thanks for catching that. Fixed in de635ac.
from commando.
Related Issues (20)
- CommandoMessage does not refer to CommandoClient
- Async run is only possible when giving arguments
- Bug: Using unsafe instanceof Array leads to issues in some environments HOT 3
- Slash commands support HOT 5
- Problems with the CommandDispatcher interface?
- problems installing commando HOT 2
- Include ‘message.channel.id’ in arg as ‘default’ HOT 1
- Support for V13? HOT 8
- Support `<#channelid>` input for non-text channels. HOT 2
- Registers channel ID for arguments when it cant send messages in channels. HOT 1
- TypeError: Cannot read property 'id' of undefined HOT 3
- RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string.
- Preset help command says DM's are disabled when they aren't. HOT 2
- [Question] Command pattern matching and arg parsing HOT 1
- Question using subfolders in commands HOT 1
- Sapphire HOT 1
- Incompatible with Discord.JS v13 HOT 5
- TypeError: Cannot read property 'extend' of undefined HOT 3
- problem with commando HOT 2
- v13? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commando.