Emote filter, Chat filter improvements, Disable commands, and custom

commands
This commit is contained in:
2020-06-04 23:37:10 -05:00
parent a0df294674
commit f05582baaf
16 changed files with 331 additions and 79 deletions

View File

@@ -6,6 +6,8 @@ import java.util.List;
import com.fpghoti.biscuit.Biscuit;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.config.PropertiesRetrieval;
import com.fpghoti.biscuit.util.PermUtil;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
@@ -33,6 +35,18 @@ public class CommandManager {
}
public boolean dispatch(MessageReceivedEvent e, String label, String[] args) {
if(e != null) {
if(Util.contains(PropertiesRetrieval.disabledCommands(), label)) {
return false;
}
if(!PermUtil.isAdmin(e.getMember()) && Util.contains(PropertiesRetrieval.disabledUserCommands(), label)) {
return false;
}
}
String input = label + " ";
for (String s : args) {
input += s + " ";
@@ -68,6 +82,17 @@ public class CommandManager {
((ConsoleCommand)match).execute(trimmedArgs);
}
}
}else {
if(Util.contains(PropertiesRetrieval.getCustomCmds(), label)) {
CustomCommand cc = new CustomCommand(label);
if(args.length >= 1) {
commandReply(e, "``Command:" + " " + cc.getName() + "``");
commandReply(e, "``Description:" + " " + cc.getDescription() + "``");
commandReply(e, "``Usage:" + " " + cc.getUsage() + "``");
}else {
commandReply(e, CustomCommand.fixPlaceholders(e, cc.getMessage()));
}
}
}
return true;
}