|
|
|
@ -86,7 +86,7 @@ class CommandDispatcher
|
|
|
|
|
// Command matcher
|
|
|
|
|
Matcher m = Pattern.compile("^" + commandPrefix + "([:\\w]+)(?: (.*))?$").matcher(event.getMessage().getContent());
|
|
|
|
|
if(!m.matches()) return; // We don't need to go further if it's not even a command
|
|
|
|
|
String fullCommand = m.group(1);
|
|
|
|
|
String fullCommand = m.group(1).toLowerCase();
|
|
|
|
|
|
|
|
|
|
// Arg splitter
|
|
|
|
|
Matcher am = Pattern.compile("([^\"]\\S*|\".+?\")\\s*").matcher((m.group(2) != null) ? m.group(2) : "");
|
|
|
|
@ -188,7 +188,7 @@ class CommandDispatcher
|
|
|
|
|
for(Method j : i.getClass().getDeclaredMethods())
|
|
|
|
|
if(j.isAnnotationPresent(Command.class))
|
|
|
|
|
{
|
|
|
|
|
String id = i.getClass().getAnnotation(Controllable.class).name() + ":" + j.getName();
|
|
|
|
|
String id = i.getClass().getAnnotation(Controllable.class).name() + ":" + j.getName().toLowerCase();
|
|
|
|
|
logger.info("Found " + id);
|
|
|
|
|
|
|
|
|
|
if(j.getParameterCount() >= 1 && j.getParameterTypes()[0] == MessageReceivedEvent.class && j.getReturnType() == String.class)
|
|
|
|
@ -198,8 +198,8 @@ class CommandDispatcher
|
|
|
|
|
|
|
|
|
|
// Eventual command shorthands
|
|
|
|
|
if(!j.getAnnotation(Command.class).shorthand().isEmpty())
|
|
|
|
|
if(!shortList.containsKey(j.getAnnotation(Command.class).shorthand()))
|
|
|
|
|
shortList.put(j.getAnnotation(Command.class).shorthand(), id);
|
|
|
|
|
if(!shortList.containsKey(j.getAnnotation(Command.class).shorthand().toLowerCase()))
|
|
|
|
|
shortList.put(j.getAnnotation(Command.class).shorthand().toLowerCase(), id);
|
|
|
|
|
else
|
|
|
|
|
logger.warning("Conflicting shorthand for command " + id);
|
|
|
|
|
}
|
|
|
|
|