change to register all commands at once to use bulk overwrite features

This commit is contained in:
tueem 2024-10-25 20:47:06 +02:00
parent 0c9d8ecb53
commit 4a13899975
No known key found for this signature in database
GPG Key ID: 819A0F7C36B9CF07
2 changed files with 3 additions and 2 deletions

@ -2,6 +2,7 @@ package net.tomatentum.marinara.registry;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
@ -45,7 +46,7 @@ public class InteractionRegistry {
defs.add(new ApplicationCommandDefinition(def.applicationCommand()).addExecutableCommand(def));
});
defs.forEach(wrapper::registerApplicationCommand);
wrapper.registerApplicationCommands(defs.toArray(new ApplicationCommandDefinition[0]));
}
public void handle(Object context) {

@ -17,7 +17,7 @@ public abstract class LibraryWrapper {
interactionSubscriber = new ArrayList<>();
}
public abstract void registerApplicationCommand(ApplicationCommandDefinition def);
public abstract void registerApplicationCommands(ApplicationCommandDefinition[] defs);
public void handleInteraction(Object context) {
interactionSubscriber.forEach((o) -> o.accept(context));