diff --git a/src/main/java/ren/taske/nativebot/bot/chatting/Chatting.java b/src/main/java/ren/taske/nativebot/bot/chatting/Chatting.java index 7c39faa..76732a9 100644 --- a/src/main/java/ren/taske/nativebot/bot/chatting/Chatting.java +++ b/src/main/java/ren/taske/nativebot/bot/chatting/Chatting.java @@ -56,7 +56,10 @@ public class Chatting { if(isPrefixed(message)) { - message = removePrefix(message); + if(shouldSubstring(message)) { + message = removePrefix(message); + } + message = CQUtils.removeCqCode(message); StringBuffer sb = new StringBuffer(); @@ -97,7 +100,9 @@ public class Chatting { if(isPrefixed(message)) { - message = removePrefix(message); + if(shouldSubstring(message)) { + message = removePrefix(message); + } evt.setMessage(message); @@ -120,6 +125,11 @@ public class Chatting { return false; } + public static boolean shouldSubstring(String message) { + if(!Config.require_prefix) return false; + return true; + } + public static String removePrefix(String message) { return message.length() < 1 ? "" : message.substring(1); }