diff --git a/.gitignore b/.gitignore index 3c7663d..e3cf634 100644 --- a/.gitignore +++ b/.gitignore @@ -147,4 +147,4 @@ bin/ build *-config.yml -modules/ +modulesre/ diff --git a/build.gradle b/build.gradle index 351220b..add7598 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { mainClassName = 'tech.nevets.modbot.CoreBot' group 'tech.nevets' -version '1.1.0' +version '1.2.0' sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 @@ -25,7 +25,7 @@ repositories { dependencies { implementation 'net.dv8tion:JDA:4.4.0_350' - implementation 'ch.qos.logback:logback-classic:1.2.11' + implementation 'ch.qos.logback:logback-classic:1.4.0' implementation 'com.google.code.gson:gson:2.9.0' implementation 'me.carleslc.Simple-YAML:Simple-Yaml:1.7.2' } diff --git a/src/main/java/tech/nevets/modbot/util/commands/CommandManager.java b/src/main/java/tech/nevets/modbot/CommandManager.java similarity index 80% rename from src/main/java/tech/nevets/modbot/util/commands/CommandManager.java rename to src/main/java/tech/nevets/modbot/CommandManager.java index 3e5f4dc..b752fee 100644 --- a/src/main/java/tech/nevets/modbot/util/commands/CommandManager.java +++ b/src/main/java/tech/nevets/modbot/CommandManager.java @@ -1,9 +1,6 @@ -package tech.nevets.modbot.util.commands; +package tech.nevets.modbot; -import tech.nevets.modbot.api.commands.CommandRegistry; -import tech.nevets.modbot.api.commands.ICommand; -import tech.nevets.modbot.api.commands.IPrefixCommand; -import tech.nevets.modbot.api.commands.ISlashCommand; +import tech.nevets.modbot.api.commands.*; import javax.annotation.Nullable; import java.util.ArrayList; @@ -14,6 +11,20 @@ public class CommandManager { public static final List ALL_PREFIX_COMMANDS = new ArrayList<>(); public static final List ALL_SLASH_COMMANDS = new ArrayList<>(); + public static void addFromRegistry(List cmds) { + for (ICommand cmd : cmds) { + ALL_COMMANDS.add(cmd); + if (cmd instanceof IPrefixCommand) { + ALL_PREFIX_COMMANDS.add((IPrefixCommand) cmd); + } + if (cmd instanceof ISlashCommand) { + ALL_SLASH_COMMANDS.add((ISlashCommand) cmd); + } + } + } + + + public static void addFromRegistry(CommandRegistry registry) { ALL_COMMANDS.addAll(registry.getCommands()); ALL_PREFIX_COMMANDS.addAll(registry.getPrefixCommands()); diff --git a/src/main/java/tech/nevets/modbot/CoreBot.java b/src/main/java/tech/nevets/modbot/CoreBot.java index ae52a9b..81f8a73 100644 --- a/src/main/java/tech/nevets/modbot/CoreBot.java +++ b/src/main/java/tech/nevets/modbot/CoreBot.java @@ -9,7 +9,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import tech.nevets.modbot.api.BotModule; import tech.nevets.modbot.api.Config; -import tech.nevets.modbot.util.commands.CoreListener; +import tech.nevets.modbot.internal.InternalListener; import javax.security.auth.login.LoginException; import java.util.*; @@ -28,7 +28,7 @@ public class CoreBot { CORE_CONFIG.loadConfig(); botPrefix = CORE_CONFIG.getConfig().getString("bot.prefix"); modules = ModuleLoader.loadModules(); - CoreListener coreListener = new CoreListener(); + InternalListener coreListener = new InternalListener(); JDABuilder builder = JDABuilder.createDefault(CORE_CONFIG.getConfig().getString("bot.token")) .enableCache(CacheFlag.VOICE_STATE) diff --git a/src/main/java/tech/nevets/modbot/EventExecutor.java b/src/main/java/tech/nevets/modbot/EventExecutor.java new file mode 100644 index 0000000..0e6ce1f --- /dev/null +++ b/src/main/java/tech/nevets/modbot/EventExecutor.java @@ -0,0 +1,1019 @@ +package tech.nevets.modbot; + +import net.dv8tion.jda.api.events.*; +import net.dv8tion.jda.api.events.application.*; +import net.dv8tion.jda.api.events.channel.category.*; +import net.dv8tion.jda.api.events.channel.category.update.*; +import net.dv8tion.jda.api.events.channel.store.*; +import net.dv8tion.jda.api.events.channel.store.update.*; +import net.dv8tion.jda.api.events.channel.text.*; +import net.dv8tion.jda.api.events.channel.text.update.*; +import net.dv8tion.jda.api.events.channel.voice.*; +import net.dv8tion.jda.api.events.channel.voice.update.*; +import net.dv8tion.jda.api.events.emote.*; +import net.dv8tion.jda.api.events.emote.update.*; +import net.dv8tion.jda.api.events.guild.*; +import net.dv8tion.jda.api.events.guild.invite.*; +import net.dv8tion.jda.api.events.guild.member.*; +import net.dv8tion.jda.api.events.guild.member.update.*; +import net.dv8tion.jda.api.events.guild.override.*; +import net.dv8tion.jda.api.events.guild.update.*; +import net.dv8tion.jda.api.events.guild.voice.*; +import net.dv8tion.jda.api.events.http.HttpRequestEvent; +import net.dv8tion.jda.api.events.interaction.*; +import net.dv8tion.jda.api.events.message.*; +import net.dv8tion.jda.api.events.message.guild.*; +import net.dv8tion.jda.api.events.message.guild.react.*; +import net.dv8tion.jda.api.events.message.priv.*; +import net.dv8tion.jda.api.events.message.priv.react.*; +import net.dv8tion.jda.api.events.message.react.*; +import net.dv8tion.jda.api.events.role.*; +import net.dv8tion.jda.api.events.role.update.*; +import net.dv8tion.jda.api.events.self.*; +import net.dv8tion.jda.api.events.stage.*; +import net.dv8tion.jda.api.events.stage.update.*; +import net.dv8tion.jda.api.events.user.*; +import net.dv8tion.jda.api.events.user.update.*; +import net.dv8tion.jda.api.hooks.ListenerAdapter; + +import javax.annotation.Nonnull; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +public class EventExecutor extends ListenerAdapter { + private final List listenerMethods = new ArrayList<>(); + + public void registerListener(ListenerAdapter listener) { + Class clazz = listener.getClass(); + listenerMethods.addAll(List.of(clazz.getDeclaredMethods())); + } + + @Override + public void onGenericEvent(@Nonnull GenericEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGenericEvent")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGenericUpdate(@Nonnull UpdateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGenericUpdate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onRawGateway(@Nonnull RawGatewayEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onRawGateway")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGatewayPing(@Nonnull GatewayPingEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGatewayPing")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //JDA Events + @Override + public void onReady(@Nonnull ReadyEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onReady")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onResumed(@Nonnull ResumedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onResumed")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onReconnected(@Nonnull ReconnectedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onReconnected")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onDisconnect(@Nonnull DisconnectEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onDisconnect")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onShutdown(@Nonnull ShutdownEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onShutdown")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onStatusChange(@Nonnull StatusChangeEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onStatusChange")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onException(@Nonnull ExceptionEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onException")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //Interaction Events + @Override + public void onSlashCommand(@Nonnull SlashCommandEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onSlashCommand")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onButtonClick(@Nonnull ButtonClickEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onButtonClick")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onSelectionMenu(@Nonnull SelectionMenuEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onSelectionMenu")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //Application Events + @Override + public void onApplicationCommandUpdate(@Nonnull ApplicationCommandUpdateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onApplicationCommandUpdate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onApplicationCommandDelete(@Nonnull ApplicationCommandDeleteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onApplicationCommandDelete")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onApplicationCommandCreate(@Nonnull ApplicationCommandCreateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onApplicationCommandCreate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //User Events + @Override + public void onUserUpdateName(@Nonnull UserUpdateNameEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserUpdateName")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserUpdateDiscriminator(@Nonnull UserUpdateDiscriminatorEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserUpdateDiscriminator")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserUpdateAvatar(@Nonnull UserUpdateAvatarEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserUpdateAvatar")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserUpdateOnlineStatus(@Nonnull UserUpdateOnlineStatusEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserUpdateOnlineStatus")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserUpdateActivityOrder(@Nonnull UserUpdateActivityOrderEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserUpdateActivityOrder")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserUpdateFlags(@Nonnull UserUpdateFlagsEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserUpdateFlags")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserTyping(@Nonnull UserTypingEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserTyping")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserActivityStart(@Nonnull UserActivityStartEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserActivityStart")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserActivityEnd(@Nonnull UserActivityEndEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserActivityEnd")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onUserUpdateActivities(@Nonnull UserUpdateActivitiesEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onUserUpdateActivities")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //Self Events. Fires only in relation to the currently logged in account. + @Override + public void onSelfUpdateAvatar(@Nonnull SelfUpdateAvatarEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onSelfUpdateAvatar")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onSelfUpdateMFA(@Nonnull SelfUpdateMFAEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onSelfUpdateMFA")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onSelfUpdateName(@Nonnull SelfUpdateNameEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onSelfUpdateName")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onSelfUpdateVerified(@Nonnull SelfUpdateVerifiedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onSelfUpdateVerified")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //Message Events + //Guild (TextChannel) Message Events + @Override + public void onGuildMessageReceived(@Nonnull GuildMessageReceivedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGuildMessageReceived")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGuildMessageUpdate(@Nonnull GuildMessageUpdateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGuildMessageUpdate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGuildMessageDelete(@Nonnull GuildMessageDeleteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGuildMessageDelete")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGuildMessageEmbed(@Nonnull GuildMessageEmbedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGuildMessageEmbed")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGuildMessageReactionAdd(@Nonnull GuildMessageReactionAddEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGuildMessageReactionAdd")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGuildMessageReactionRemove(@Nonnull GuildMessageReactionRemoveEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGuildMessageReactionRemove")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGuildMessageReactionRemoveAll(@Nonnull GuildMessageReactionRemoveAllEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGuildMessageReactionRemoveAll")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onGuildMessageReactionRemoveEmote(@Nonnull GuildMessageReactionRemoveEmoteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onGuildMessageReactionRemoveEmote")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //Private Message Events + @Override + public void onPrivateMessageReceived(@Nonnull PrivateMessageReceivedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPrivateMessageReceived")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onPrivateMessageUpdate(@Nonnull PrivateMessageUpdateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPrivateMessageUpdate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onPrivateMessageDelete(@Nonnull PrivateMessageDeleteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPrivateMessageDelete")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onPrivateMessageEmbed(@Nonnull PrivateMessageEmbedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPrivateMessageEmbed")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onPrivateMessageReactionAdd(@Nonnull PrivateMessageReactionAddEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPrivateMessageReactionAdd")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onPrivateMessageReactionRemove(@Nonnull PrivateMessageReactionRemoveEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPrivateMessageReactionRemove")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //Combined Message Events (Combines Guild and Private message into 1 event) + @Override + public void onMessageReceived(@Nonnull MessageReceivedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageReceived")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onMessageUpdate(@Nonnull MessageUpdateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageUpdate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onMessageDelete(@Nonnull MessageDeleteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageDelete")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onMessageBulkDelete(@Nonnull MessageBulkDeleteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageBulkDelete")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onMessageEmbed(@Nonnull MessageEmbedEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageEmbed")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onMessageReactionAdd(@Nonnull MessageReactionAddEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageReactionAdd")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onMessageReactionRemove(@Nonnull MessageReactionRemoveEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageReactionRemove")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onMessageReactionRemoveAll(@Nonnull MessageReactionRemoveAllEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageReactionRemoveAll")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onMessageReactionRemoveEmote(@Nonnull MessageReactionRemoveEmoteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onMessageReactionRemoveEmote")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //PermissionOverride Events + @Override + public void onPermissionOverrideDelete(@Nonnull PermissionOverrideDeleteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPermissionOverrideDelete")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onPermissionOverrideUpdate(@Nonnull PermissionOverrideUpdateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPermissionOverrideUpdate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onPermissionOverrideCreate(@Nonnull PermissionOverrideCreateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onPermissionOverrideCreate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //StoreChannel Events + @Override + public void onStoreChannelDelete(@Nonnull StoreChannelDeleteEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onStoreChannelDelete")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onStoreChannelUpdateName(@Nonnull StoreChannelUpdateNameEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onStoreChannelUpdateName")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onStoreChannelUpdatePosition(@Nonnull StoreChannelUpdatePositionEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onStoreChannelUpdatePosition")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + @Override + public void onStoreChannelCreate(@Nonnull StoreChannelCreateEvent event) { + for (Method method : listenerMethods) { + if (method.getName().equals("onStoreChannelCreate")) { + try { + method.invoke(event); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + } + + //TextChannel Events + public void onTextChannelDelete(@Nonnull TextChannelDeleteEvent event) {} + public void onTextChannelUpdateName(@Nonnull TextChannelUpdateNameEvent event) {} + public void onTextChannelUpdateTopic(@Nonnull TextChannelUpdateTopicEvent event) {} + public void onTextChannelUpdatePosition(@Nonnull TextChannelUpdatePositionEvent event) {} + public void onTextChannelUpdateNSFW(@Nonnull TextChannelUpdateNSFWEvent event) {} + public void onTextChannelUpdateParent(@Nonnull TextChannelUpdateParentEvent event) {} + public void onTextChannelUpdateSlowmode(@Nonnull TextChannelUpdateSlowmodeEvent event) {} + public void onTextChannelUpdateNews(@Nonnull TextChannelUpdateNewsEvent event) {} + public void onTextChannelCreate(@Nonnull TextChannelCreateEvent event) {} + + //VoiceChannel Events + public void onVoiceChannelDelete(@Nonnull VoiceChannelDeleteEvent event) {} + public void onVoiceChannelUpdateName(@Nonnull VoiceChannelUpdateNameEvent event) {} + public void onVoiceChannelUpdatePosition(@Nonnull VoiceChannelUpdatePositionEvent event) {} + public void onVoiceChannelUpdateUserLimit(@Nonnull VoiceChannelUpdateUserLimitEvent event) {} + public void onVoiceChannelUpdateBitrate(@Nonnull VoiceChannelUpdateBitrateEvent event) {} + public void onVoiceChannelUpdateParent(@Nonnull VoiceChannelUpdateParentEvent event) {} + public void onVoiceChannelUpdateRegion(@Nonnull VoiceChannelUpdateRegionEvent event) {} + public void onVoiceChannelCreate(@Nonnull VoiceChannelCreateEvent event) {} + + //Category Events + public void onCategoryDelete(@Nonnull CategoryDeleteEvent event) {} + public void onCategoryUpdateName(@Nonnull CategoryUpdateNameEvent event) {} + public void onCategoryUpdatePosition(@Nonnull CategoryUpdatePositionEvent event) {} + public void onCategoryCreate(@Nonnull CategoryCreateEvent event) {} + + //StageInstance Event + public void onStageInstanceDelete(@Nonnull StageInstanceDeleteEvent event) {} + public void onStageInstanceUpdateTopic(@Nonnull StageInstanceUpdateTopicEvent event) {} + public void onStageInstanceUpdatePrivacyLevel(@Nonnull StageInstanceUpdatePrivacyLevelEvent event) {} + public void onStageInstanceCreate(@Nonnull StageInstanceCreateEvent event) {} + + //Guild Events + public void onGuildReady(@Nonnull GuildReadyEvent event) {} + public void onGuildTimeout(@Nonnull GuildTimeoutEvent event) {} + public void onGuildJoin(@Nonnull GuildJoinEvent event) {} + public void onGuildLeave(@Nonnull GuildLeaveEvent event) {} + public void onGuildAvailable(@Nonnull GuildAvailableEvent event) {} + public void onGuildUnavailable(@Nonnull GuildUnavailableEvent event) {} + public void onUnavailableGuildJoined(@Nonnull UnavailableGuildJoinedEvent event) {} + public void onUnavailableGuildLeave(@Nonnull UnavailableGuildLeaveEvent event) {} + public void onGuildBan(@Nonnull GuildBanEvent event) {} + public void onGuildUnban(@Nonnull GuildUnbanEvent event) {} + public void onGuildMemberRemove(@Nonnull GuildMemberRemoveEvent event) {} + + //Guild Update Events + public void onGuildUpdateAfkChannel(@Nonnull GuildUpdateAfkChannelEvent event) {} + public void onGuildUpdateSystemChannel(@Nonnull GuildUpdateSystemChannelEvent event) {} + public void onGuildUpdateRulesChannel(@Nonnull GuildUpdateRulesChannelEvent event) {} + public void onGuildUpdateCommunityUpdatesChannel(@Nonnull GuildUpdateCommunityUpdatesChannelEvent event) {} + public void onGuildUpdateAfkTimeout(@Nonnull GuildUpdateAfkTimeoutEvent event) {} + public void onGuildUpdateExplicitContentLevel(@Nonnull GuildUpdateExplicitContentLevelEvent event) {} + public void onGuildUpdateIcon(@Nonnull GuildUpdateIconEvent event) {} + public void onGuildUpdateMFALevel(@Nonnull GuildUpdateMFALevelEvent event) {} + public void onGuildUpdateName(@Nonnull GuildUpdateNameEvent event){} + public void onGuildUpdateNotificationLevel(@Nonnull GuildUpdateNotificationLevelEvent event) {} + public void onGuildUpdateOwner(@Nonnull GuildUpdateOwnerEvent event) {} + + public void onGuildUpdateSplash(@Nonnull GuildUpdateSplashEvent event) {} + public void onGuildUpdateVerificationLevel(@Nonnull GuildUpdateVerificationLevelEvent event) {} + public void onGuildUpdateLocale(@Nonnull GuildUpdateLocaleEvent event) {} + public void onGuildUpdateFeatures(@Nonnull GuildUpdateFeaturesEvent event) {} + public void onGuildUpdateVanityCode(@Nonnull GuildUpdateVanityCodeEvent event) {} + public void onGuildUpdateBanner(@Nonnull GuildUpdateBannerEvent event) {} + public void onGuildUpdateDescription(@Nonnull GuildUpdateDescriptionEvent event) {} + public void onGuildUpdateBoostTier(@Nonnull GuildUpdateBoostTierEvent event) {} + public void onGuildUpdateBoostCount(@Nonnull GuildUpdateBoostCountEvent event) {} + public void onGuildUpdateMaxMembers(@Nonnull GuildUpdateMaxMembersEvent event) {} + public void onGuildUpdateMaxPresences(@Nonnull GuildUpdateMaxPresencesEvent event) {} + public void onGuildUpdateNSFWLevel(@Nonnull GuildUpdateNSFWLevelEvent event) {} + + //Guild Invite Events + public void onGuildInviteCreate(@Nonnull GuildInviteCreateEvent event) {} + public void onGuildInviteDelete(@Nonnull GuildInviteDeleteEvent event) {} + + //Guild Member Events + public void onGuildMemberJoin(@Nonnull GuildMemberJoinEvent event) {} + public void onGuildMemberRoleAdd(@Nonnull GuildMemberRoleAddEvent event) {} + public void onGuildMemberRoleRemove(@Nonnull GuildMemberRoleRemoveEvent event) {} + + //Guild Member Update Events + public void onGuildMemberUpdate(@Nonnull GuildMemberUpdateEvent event) {} + public void onGuildMemberUpdateNickname(@Nonnull GuildMemberUpdateNicknameEvent event) {} + public void onGuildMemberUpdateAvatar(@Nonnull GuildMemberUpdateAvatarEvent event) {} + public void onGuildMemberUpdateBoostTime(@Nonnull GuildMemberUpdateBoostTimeEvent event) {} + public void onGuildMemberUpdatePending(@Nonnull GuildMemberUpdatePendingEvent event) {} + + //Guild Voice Events + public void onGuildVoiceUpdate(@Nonnull GuildVoiceUpdateEvent event) {} + public void onGuildVoiceJoin(@Nonnull GuildVoiceJoinEvent event) {} + public void onGuildVoiceMove(@Nonnull GuildVoiceMoveEvent event) {} + public void onGuildVoiceLeave(@Nonnull GuildVoiceLeaveEvent event) {} + public void onGuildVoiceMute(@Nonnull GuildVoiceMuteEvent event) {} + public void onGuildVoiceDeafen(@Nonnull GuildVoiceDeafenEvent event) {} + public void onGuildVoiceGuildMute(@Nonnull GuildVoiceGuildMuteEvent event) {} + public void onGuildVoiceGuildDeafen(@Nonnull GuildVoiceGuildDeafenEvent event) {} + public void onGuildVoiceSelfMute(@Nonnull GuildVoiceSelfMuteEvent event) {} + public void onGuildVoiceSelfDeafen(@Nonnull GuildVoiceSelfDeafenEvent event) {} + public void onGuildVoiceSuppress(@Nonnull GuildVoiceSuppressEvent event) {} + public void onGuildVoiceStream(@Nonnull GuildVoiceStreamEvent event) {} + public void onGuildVoiceVideo(@Nonnull GuildVoiceVideoEvent event) {} + public void onGuildVoiceRequestToSpeak(@Nonnull GuildVoiceRequestToSpeakEvent event) {} + + //Role events + public void onRoleCreate(@Nonnull RoleCreateEvent event) {} + public void onRoleDelete(@Nonnull RoleDeleteEvent event) {} + + //Role Update Events + public void onRoleUpdateColor(@Nonnull RoleUpdateColorEvent event) {} + public void onRoleUpdateHoisted(@Nonnull RoleUpdateHoistedEvent event) {} + public void onRoleUpdateIcon(@Nonnull RoleUpdateIconEvent event) {} + public void onRoleUpdateMentionable(@Nonnull RoleUpdateMentionableEvent event) {} + public void onRoleUpdateName(@Nonnull RoleUpdateNameEvent event) {} + public void onRoleUpdatePermissions(@Nonnull RoleUpdatePermissionsEvent event) {} + public void onRoleUpdatePosition(@Nonnull RoleUpdatePositionEvent event) {} + + //Emote Events + public void onEmoteAdded(@Nonnull EmoteAddedEvent event) {} + public void onEmoteRemoved(@Nonnull EmoteRemovedEvent event) {} + + //Emote Update Events + public void onEmoteUpdateName(@Nonnull EmoteUpdateNameEvent event) {} + public void onEmoteUpdateRoles(@Nonnull EmoteUpdateRolesEvent event) {} + + // Debug Events + public void onHttpRequest(@Nonnull HttpRequestEvent event) {} + + //Generic Events + public void onGenericApplicationCommand(@Nonnull GenericApplicationCommandEvent event) {} + public void onGenericInteractionCreate(@Nonnull GenericInteractionCreateEvent event) {} + public void onGenericComponentInteractionCreate(@Nonnull GenericComponentInteractionCreateEvent event) {} + public void onGenericMessage(@Nonnull GenericMessageEvent event) {} + public void onGenericMessageReaction(@Nonnull GenericMessageReactionEvent event) {} + public void onGenericGuildMessage(@Nonnull GenericGuildMessageEvent event) {} + public void onGenericGuildMessageReaction(@Nonnull GenericGuildMessageReactionEvent event) {} + public void onGenericPrivateMessage(@Nonnull GenericPrivateMessageEvent event) {} + public void onGenericPrivateMessageReaction(@Nonnull GenericPrivateMessageReactionEvent event) {} + public void onGenericUser(@Nonnull GenericUserEvent event) {} + public void onGenericUserPresence(@Nonnull GenericUserPresenceEvent event) {} + public void onGenericSelfUpdate(@Nonnull GenericSelfUpdateEvent event) {} + public void onGenericStoreChannel(@Nonnull GenericStoreChannelEvent event) {} + public void onGenericStoreChannelUpdate(@Nonnull GenericStoreChannelUpdateEvent event) {} + public void onGenericTextChannel(@Nonnull GenericTextChannelEvent event) {} + public void onGenericTextChannelUpdate(@Nonnull GenericTextChannelUpdateEvent event) {} + public void onGenericVoiceChannel(@Nonnull GenericVoiceChannelEvent event) {} + public void onGenericVoiceChannelUpdate(@Nonnull GenericVoiceChannelUpdateEvent event) {} + public void onGenericCategory(@Nonnull GenericCategoryEvent event) {} + public void onGenericCategoryUpdate(@Nonnull GenericCategoryUpdateEvent event) {} + public void onGenericStageInstance(@Nonnull GenericStageInstanceEvent event) {} + public void onGenericStageInstanceUpdate(@Nonnull GenericStageInstanceUpdateEvent event) {} + public void onGenericGuild(@Nonnull GenericGuildEvent event) {} + public void onGenericGuildUpdate(@Nonnull GenericGuildUpdateEvent event) {} + public void onGenericGuildInvite(@Nonnull GenericGuildInviteEvent event) {} + public void onGenericGuildMember(@Nonnull GenericGuildMemberEvent event) {} + public void onGenericGuildMemberUpdate(@Nonnull GenericGuildMemberUpdateEvent event) {} + public void onGenericGuildVoice(@Nonnull GenericGuildVoiceEvent event) {} + public void onGenericRole(@Nonnull GenericRoleEvent event) {} + public void onGenericRoleUpdate(@Nonnull GenericRoleUpdateEvent event) {} + public void onGenericEmote(@Nonnull GenericEmoteEvent event) {} + public void onGenericEmoteUpdate(@Nonnull GenericEmoteUpdateEvent event) {} + public void onGenericPermissionOverride(@Nonnull GenericPermissionOverrideEvent event) {} +} diff --git a/src/main/java/tech/nevets/modbot/Listener.java b/src/main/java/tech/nevets/modbot/Listener.java new file mode 100644 index 0000000..6722490 --- /dev/null +++ b/src/main/java/tech/nevets/modbot/Listener.java @@ -0,0 +1,15 @@ +package tech.nevets.modbot; + +import net.dv8tion.jda.api.hooks.ListenerAdapter; +import tech.nevets.modbot.api.commands.ICommand; + +import java.util.ArrayList; +import java.util.List; + +public abstract class Listener extends ListenerAdapter { + public final List commands = new ArrayList<>(); + + void addCommand(ICommand cmd) { + commands.add(cmd); + } +} diff --git a/src/main/java/tech/nevets/modbot/ModuleLoader.java b/src/main/java/tech/nevets/modbot/ModuleLoader.java index 1c4cda2..807cd51 100644 --- a/src/main/java/tech/nevets/modbot/ModuleLoader.java +++ b/src/main/java/tech/nevets/modbot/ModuleLoader.java @@ -44,9 +44,6 @@ public class ModuleLoader { return modules; } - //TODO: make this dynamically wrap all interface modules into abstract modules - //TODO: handle both types of modules - public static List loadModules() { List modulePaths = getModules(); List modules = new ArrayList<>(); @@ -103,6 +100,7 @@ public class ModuleLoader { iNewModule = (IBotModule) mainClass.getDeclaredConstructor().newInstance(); } catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) { LOGGER.error("Error while creating instance of module " + moduleName); + //TODO: Check if setting Module-Type to inherit wile using extend breaks here e.printStackTrace(); continue; } @@ -112,6 +110,7 @@ public class ModuleLoader { newModule = (BotModule) mainClass.getDeclaredConstructor(String.class).newInstance(moduleName); } catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) { LOGGER.error("Error while creating instance of module " + moduleName); + LOGGER.error("HINT: Check the Module-Type of module " + moduleName); e.printStackTrace(); continue; } @@ -137,7 +136,7 @@ public class ModuleLoader { StringBuilder sb = new StringBuilder(); for (int i = 0; i < modules.size(); i++) { sb.append(modules.get(i).getModuleName()); - if (i < modules.size()) { + if ((i + 1) < modules.size()) { sb.append(", "); } } diff --git a/src/main/java/tech/nevets/modbot/Registry.java b/src/main/java/tech/nevets/modbot/Registry.java new file mode 100644 index 0000000..8d7951a --- /dev/null +++ b/src/main/java/tech/nevets/modbot/Registry.java @@ -0,0 +1,20 @@ +package tech.nevets.modbot; + +import net.dv8tion.jda.api.hooks.ListenerAdapter; +import tech.nevets.modbot.api.commands.IPrefixCommand; +import tech.nevets.modbot.api.commands.ISlashCommand; + +public class Registry { + + public static void register(IPrefixCommand cmd) { + + } + + public static void register(ISlashCommand cmd) { + + } + + public static void register(ListenerAdapter listener) { + + } +} diff --git a/src/main/java/tech/nevets/modbot/api/IBotModule.java b/src/main/java/tech/nevets/modbot/api/IBotModule.java index 9fb42c0..b6cc5f1 100644 --- a/src/main/java/tech/nevets/modbot/api/IBotModule.java +++ b/src/main/java/tech/nevets/modbot/api/IBotModule.java @@ -7,7 +7,7 @@ public interface IBotModule { default void onPreEnable() {} - CommandRegistry loadCommandRegistry(); + void registry(); void onEnable(JDA jda); diff --git a/src/main/java/tech/nevets/modbot/util/commands/CommandContext.java b/src/main/java/tech/nevets/modbot/api/commands/CommandContext.java similarity index 90% rename from src/main/java/tech/nevets/modbot/util/commands/CommandContext.java rename to src/main/java/tech/nevets/modbot/api/commands/CommandContext.java index ccb17d4..6ad2e39 100644 --- a/src/main/java/tech/nevets/modbot/util/commands/CommandContext.java +++ b/src/main/java/tech/nevets/modbot/api/commands/CommandContext.java @@ -1,7 +1,8 @@ -package tech.nevets.modbot.util.commands; +package tech.nevets.modbot.api.commands; import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent; +import tech.nevets.modbot.api.commands.ICommandContext; import java.util.List; diff --git a/src/main/java/tech/nevets/modbot/api/commands/CommandRegistry.java b/src/main/java/tech/nevets/modbot/api/commands/CommandRegistry.java index 8574593..88d0b13 100644 --- a/src/main/java/tech/nevets/modbot/api/commands/CommandRegistry.java +++ b/src/main/java/tech/nevets/modbot/api/commands/CommandRegistry.java @@ -8,7 +8,6 @@ import net.dv8tion.jda.api.interactions.commands.build.CommandData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import tech.nevets.modbot.CoreBot; -import tech.nevets.modbot.util.commands.CommandContext; import javax.annotation.Nullable; import java.util.ArrayList; diff --git a/src/main/java/tech/nevets/modbot/util/commands/ICommandContext.java b/src/main/java/tech/nevets/modbot/api/commands/ICommandContext.java similarity index 99% rename from src/main/java/tech/nevets/modbot/util/commands/ICommandContext.java rename to src/main/java/tech/nevets/modbot/api/commands/ICommandContext.java index 6aa18ec..2a5eede 100644 --- a/src/main/java/tech/nevets/modbot/util/commands/ICommandContext.java +++ b/src/main/java/tech/nevets/modbot/api/commands/ICommandContext.java @@ -1,4 +1,4 @@ -package tech.nevets.modbot.util.commands; +package tech.nevets.modbot.api.commands; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.*; diff --git a/src/main/java/tech/nevets/modbot/api/commands/IPrefixCommand.java b/src/main/java/tech/nevets/modbot/api/commands/IPrefixCommand.java index 31db4d2..abdc69d 100644 --- a/src/main/java/tech/nevets/modbot/api/commands/IPrefixCommand.java +++ b/src/main/java/tech/nevets/modbot/api/commands/IPrefixCommand.java @@ -1,7 +1,5 @@ package tech.nevets.modbot.api.commands; -import tech.nevets.modbot.util.commands.CommandContext; - public interface IPrefixCommand extends ICommand { void handle(CommandContext ctx); diff --git a/src/main/java/tech/nevets/modbot/api/commands/ISlashCommand.java b/src/main/java/tech/nevets/modbot/api/commands/ISlashCommand.java index c0f692e..8d83c0b 100644 --- a/src/main/java/tech/nevets/modbot/api/commands/ISlashCommand.java +++ b/src/main/java/tech/nevets/modbot/api/commands/ISlashCommand.java @@ -1,7 +1,6 @@ package tech.nevets.modbot.api.commands; import net.dv8tion.jda.api.interactions.commands.build.CommandData; -import tech.nevets.modbot.util.commands.CommandContext; public interface ISlashCommand extends ICommand { diff --git a/src/main/java/tech/nevets/modbot/util/commands/CoreListener.java b/src/main/java/tech/nevets/modbot/internal/InternalListener.java similarity index 84% rename from src/main/java/tech/nevets/modbot/util/commands/CoreListener.java rename to src/main/java/tech/nevets/modbot/internal/InternalListener.java index ab51acd..df9d296 100644 --- a/src/main/java/tech/nevets/modbot/util/commands/CoreListener.java +++ b/src/main/java/tech/nevets/modbot/internal/InternalListener.java @@ -1,4 +1,4 @@ -package tech.nevets.modbot.util.commands; +package tech.nevets.modbot.internal; import net.dv8tion.jda.api.entities.User; import net.dv8tion.jda.api.events.ReadyEvent; @@ -9,11 +9,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import tech.nevets.modbot.CoreBot; import tech.nevets.modbot.api.commands.CommandRegistry; +import tech.nevets.modbot.CommandManager; +import tech.nevets.modbot.internal.commands.HelpCmd; +import tech.nevets.modbot.internal.commands.TestCmd; import javax.annotation.Nonnull; -public class CoreListener extends ListenerAdapter { - private static final Logger LOGGER = LoggerFactory.getLogger(CoreListener.class); +public class InternalListener extends ListenerAdapter { + private static final Logger LOGGER = LoggerFactory.getLogger(InternalListener.class); private final CommandRegistry registry = new CommandRegistry(); { diff --git a/src/main/java/tech/nevets/modbot/util/commands/HelpCmd.java b/src/main/java/tech/nevets/modbot/internal/commands/HelpCmd.java similarity index 95% rename from src/main/java/tech/nevets/modbot/util/commands/HelpCmd.java rename to src/main/java/tech/nevets/modbot/internal/commands/HelpCmd.java index 32ededb..69b1ef4 100644 --- a/src/main/java/tech/nevets/modbot/util/commands/HelpCmd.java +++ b/src/main/java/tech/nevets/modbot/internal/commands/HelpCmd.java @@ -1,4 +1,4 @@ -package tech.nevets.modbot.util.commands; +package tech.nevets.modbot.internal.commands; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.Command; @@ -7,7 +7,9 @@ import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.commands.build.OptionData; import org.jetbrains.annotations.NotNull; +import tech.nevets.modbot.CommandManager; import tech.nevets.modbot.CoreBot; +import tech.nevets.modbot.api.commands.CommandContext; import tech.nevets.modbot.api.commands.ICommand; import tech.nevets.modbot.api.commands.IPrefixCommand; import tech.nevets.modbot.api.commands.ISlashCommand; diff --git a/src/main/java/tech/nevets/modbot/util/commands/TestCmd.java b/src/main/java/tech/nevets/modbot/internal/commands/TestCmd.java similarity index 93% rename from src/main/java/tech/nevets/modbot/util/commands/TestCmd.java rename to src/main/java/tech/nevets/modbot/internal/commands/TestCmd.java index 8094cdc..313d2e3 100644 --- a/src/main/java/tech/nevets/modbot/util/commands/TestCmd.java +++ b/src/main/java/tech/nevets/modbot/internal/commands/TestCmd.java @@ -1,8 +1,9 @@ -package tech.nevets.modbot.util.commands; +package tech.nevets.modbot.internal.commands; import net.dv8tion.jda.api.entities.IMentionable; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.build.CommandData; +import tech.nevets.modbot.api.commands.CommandContext; import tech.nevets.modbot.api.commands.ISlashCommand; public class TestCmd implements ISlashCommand { diff --git a/src/main/java/tech/nevets/modbot/util/Pair.java b/src/main/java/tech/nevets/modbot/util/Pair.java index afa2624..5af26de 100644 --- a/src/main/java/tech/nevets/modbot/util/Pair.java +++ b/src/main/java/tech/nevets/modbot/util/Pair.java @@ -29,6 +29,6 @@ public class Pair { @Override public String toString() { - return "Pair{" + left + ", right=" + right + "}"; + return "Pair{left=" + left + ", right=" + right + "}"; } }