Skip to content

Commit

Permalink
Fix of the default prefix @mention that was no longer responding to c…
Browse files Browse the repository at this point in the history
…ommands (#40)
  • Loading branch information
brandonfl authored Dec 26, 2021
1 parent afa1b07 commit 28dc4f6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,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;
return makeMessageParts(rawContent, prefixLength);
}
}
Expand Down

0 comments on commit 28dc4f6

Please sign in to comment.