Skip to content

Conversation

SuSeu1414
Copy link
Contributor

I added an option to use bot mention as a command prefix. Might be useful when you have per-server prefixes and forget what prefix is used in a particular server. You can enable it with this code:

JDACommandConfig config = new JDACommandConfig();
config.useMentionPrefix(true);

It's disabled by default, so it won't change any behaviour until you turn it on

if (prefixFound == null) {
return;
}

String[] args = ACFPatterns.SPACE.split(msg.substring(prefixFound.length()), -1);
// str.replaceAll("^[ \t]+", "") - works like String.stripLeading() from Java 11
String[] args = ACFPatterns.SPACE.split(msg.substring(prefixFound.length()).replaceAll("^[ \\t]+", ""), -1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that this pattern should be cached

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now I'm using ACFPatterns.getPattern() which caches patterns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants