diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java b/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java index 0da46da0..0036961e 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java @@ -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); } }