Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix of the default prefix @mention that was no longer responding to commands #40

Merged
merged 2 commits into from
Dec 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,10 @@ private MessageParts getParts(MessageReceivedEvent event) {
if(prefix.equals(DEFAULT_PREFIX) || (altprefix != null && altprefix.equals(DEFAULT_PREFIX))) {
if(rawContent.startsWith("<@"+ event.getJDA().getSelfUser().getId()+">") ||
rawContent.startsWith("<@!"+ event.getJDA().getSelfUser().getId()+">")) {
final int prefixLength = rawContent.indexOf('>') + 1;
// Since we now use substring into makeMessageParts function and a indexOf here, we need to do a +1 to get the good substring
// On top of that we need to do another +1 because the default @mention prefix will always be followed by a space
// So we need to add 2 characters to get the correct substring
final int prefixLength = rawContent.indexOf('>') + 2;
Chew marked this conversation as resolved.
Show resolved Hide resolved
return makeMessageParts(rawContent, prefixLength);
}
}
Expand Down