forked from Fascinated/Bat
cleanup how i add sub commands to the commands
This commit is contained in:
parent
39c3d471c7
commit
b37a30b0a3
@ -20,6 +20,7 @@ import net.dv8tion.jda.api.interactions.commands.build.OptionData;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
|
||||
import net.dv8tion.jda.internal.interactions.CommandDataImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@ -32,11 +33,15 @@ public class ScoreSaberCommand extends BatCommand {
|
||||
private final ScoreSaberService scoreSaberService;
|
||||
|
||||
@Autowired
|
||||
public ScoreSaberCommand(@NonNull ScoreSaberService scoreSaberService) {
|
||||
public ScoreSaberCommand(@NonNull ScoreSaberService scoreSaberService, @NonNull ApplicationContext context) {
|
||||
super("scoresaber");
|
||||
super.setCategory(Category.BEAT_SABER);
|
||||
this.scoreSaberService = scoreSaberService;
|
||||
|
||||
super.addSubCommand("link", context.getBean(LinkSubCommand.class));
|
||||
super.addSubCommand("user", context.getBean(UserSubCommand.class));
|
||||
super.addSubCommand("me", context.getBean(MeSubCommand.class));
|
||||
|
||||
super.setDescription("General ScoreSaber commands");
|
||||
super.setCommandData(new CommandDataImpl(this.getName(), this.getDescription())
|
||||
.addSubcommands(new SubcommandData("link", "Link your ScoreSaber profile")
|
||||
|
@ -1,12 +1,14 @@
|
||||
package cc.fascinated.bat.features.scoresaber.command.userfeed;
|
||||
|
||||
import cc.fascinated.bat.command.BatCommand;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
|
||||
import net.dv8tion.jda.internal.interactions.CommandDataImpl;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -14,10 +16,14 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component("scoresaber-userfeed:feed.sub")
|
||||
public class UserFeedCommand extends BatCommand {
|
||||
public UserFeedCommand() {
|
||||
public UserFeedCommand(@NonNull ApplicationContext context) {
|
||||
super("scoresaber-userfeed");
|
||||
super.setCategory(Category.BEAT_SABER);
|
||||
|
||||
super.addSubCommand("user", context.getBean(UserSubCommand.class));
|
||||
super.addSubCommand("channel", context.getBean(ChannelSubCommand.class));
|
||||
super.addSubCommand("clear-users", context.getBean(ClearUsersSubCommand.class));
|
||||
|
||||
super.setDescription("ScoreSaber user score feed commands");
|
||||
super.setCommandData(new CommandDataImpl(this.getName(), this.getDescription())
|
||||
.addSubcommands(new SubcommandData("user", "Edit your ScoreSaber score feed settings")
|
||||
|
@ -55,19 +55,10 @@ public class CommandService extends ListenerAdapter {
|
||||
DiscordService.JDA.addEventListener(this);
|
||||
|
||||
// Guild commands
|
||||
// todo: add some, duh
|
||||
registerCommand(context.getBean(UserFeedCommand.class));
|
||||
|
||||
// Global commands
|
||||
registerCommand(context.getBean(ScoreSaberCommand.class)
|
||||
.addSubCommand("link", context.getBean(LinkSubCommand.class))
|
||||
.addSubCommand("user", context.getBean(cc.fascinated.bat.features.scoresaber.command.scoresaber.UserSubCommand.class))
|
||||
.addSubCommand("me", context.getBean(MeSubCommand.class))
|
||||
);
|
||||
registerCommand(context.getBean(UserFeedCommand.class)
|
||||
.addSubCommand("user", context.getBean(UserSubCommand.class))
|
||||
.addSubCommand("channel", context.getBean(ChannelSubCommand.class))
|
||||
.addSubCommand("clear-users", context.getBean(ClearUsersSubCommand.class))
|
||||
);
|
||||
registerCommand(context.getBean(ScoreSaberCommand.class));
|
||||
|
||||
registerSlashCommands(); // Register all slash commands
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user