forked from Fascinated/Bat
cleanup commands
This commit is contained in:
@ -2,12 +2,7 @@ package cc.fascinated.bat.service;
|
||||
|
||||
import cc.fascinated.bat.command.BatCommand;
|
||||
import cc.fascinated.bat.command.BatSubCommand;
|
||||
import cc.fascinated.bat.command.impl.PingCommand;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.features.autorole.command.AutoRoleCommand;
|
||||
import cc.fascinated.bat.features.scoresaber.command.numberone.NumberOneFeedCommand;
|
||||
import cc.fascinated.bat.features.scoresaber.command.scoresaber.ScoreSaberCommand;
|
||||
import cc.fascinated.bat.features.scoresaber.command.userfeed.UserFeedCommand;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
@ -52,18 +47,7 @@ public class CommandService extends ListenerAdapter {
|
||||
this.userService = userService;
|
||||
DiscordService.JDA.addEventListener(this);
|
||||
|
||||
// todo: auto register commands
|
||||
|
||||
// Guild commands
|
||||
registerCommand(context.getBean(UserFeedCommand.class));
|
||||
registerCommand(context.getBean(NumberOneFeedCommand.class));
|
||||
registerCommand(context.getBean(AutoRoleCommand.class));
|
||||
|
||||
// Global commands
|
||||
registerCommand(context.getBean(ScoreSaberCommand.class));
|
||||
registerCommand(context.getBean(PingCommand.class));
|
||||
|
||||
registerSlashCommands(); // Register all slash commands
|
||||
context.getBeansOfType(BatCommand.class).values().forEach(this::registerCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,6 +56,10 @@ public class CommandService extends ListenerAdapter {
|
||||
* @param command The command to register
|
||||
*/
|
||||
public void registerCommand(@NonNull BatCommand command) {
|
||||
if (commands.get(command.getName().toLowerCase()) != null) {
|
||||
return;
|
||||
}
|
||||
log.info("Registered command \"{}\"", command.getName());
|
||||
commands.put(command.getName().toLowerCase(), command);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user