diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-08-25 11:21:01 -0400 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2022-08-25 11:21:01 -0400 |
commit | 33f0ab31b1043400f6d812013517ae3d07af577e (patch) | |
tree | 679ec0c021b9662f8f5fda6071ac6cbf484ef44d /src/main/java | |
parent | v6 (diff) | |
download | ken-33f0ab31b1043400f6d812013517ae3d07af577e.tar.gz ken-33f0ab31b1043400f6d812013517ae3d07af577e.tar.bz2 ken-33f0ab31b1043400f6d812013517ae3d07af577e.zip |
v7
Diffstat (limited to 'src/main/java')
43 files changed, 346 insertions, 88 deletions
diff --git a/src/main/java/net/tylermurphy/ken/Ken.java b/src/main/java/net/tylermurphy/ken/Ken.java index b9b7a97..b03ea3d 100644 --- a/src/main/java/net/tylermurphy/ken/Ken.java +++ b/src/main/java/net/tylermurphy/ken/Ken.java @@ -7,10 +7,11 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.entities.Activity; +import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.requests.GatewayIntent; import net.dv8tion.jda.api.utils.MemberCachePolicy; -import net.tylermurphy.ken.event.Responder; +import net.tylermurphy.ken.command.Responder; import net.tylermurphy.ken.database.Database; import net.tylermurphy.ken.music.PlayerManager; import org.jetbrains.annotations.NotNull; @@ -90,6 +91,8 @@ public class Ken { public Database getDatabase() { return database; } + public Role getRoleById(long id) { return api.getRoleById(id); } + public EmbedBuilder getDefaultEmbed() { EmbedBuilder builder = new EmbedBuilder(); builder.setColor(new Color( diff --git a/src/main/java/net/tylermurphy/ken/command/Register.java b/src/main/java/net/tylermurphy/ken/command/Register.java index 24c7860..800200e 100644 --- a/src/main/java/net/tylermurphy/ken/command/Register.java +++ b/src/main/java/net/tylermurphy/ken/command/Register.java @@ -5,7 +5,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.interactions.commands.build.Commands; import net.dv8tion.jda.api.interactions.commands.build.OptionData; import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData; -import net.tylermurphy.ken.event.annotation.*; +import net.tylermurphy.ken.command.annotation.*; import java.lang.reflect.Method; import java.util.*; @@ -15,6 +15,7 @@ public class Register { private final Map<String, Object> HANDLES; private final Map<String, Method> COMMAND_CALLBACKS; private final Map<String, Method> BUTTON_CALLBACKS; + private final Map<String, Method> SELECT_MENU_CALLBACKS; private final Map<String, Permission> PERMISSIONS; private final JDA api; @@ -23,6 +24,7 @@ public class Register { HANDLES = new HashMap<>(); COMMAND_CALLBACKS = new HashMap<>(); BUTTON_CALLBACKS = new HashMap<>(); + SELECT_MENU_CALLBACKS = new HashMap<>(); PERMISSIONS = new HashMap<>(); this.api = api; @@ -32,10 +34,12 @@ public class Register { if(HANDLES.containsKey(handle.getClass().getName())) return; List<Method> commands = Arrays.stream(handle.getClass().getMethods()).filter(method -> method.isAnnotationPresent(Command.class)).toList(); List<Method> buttons = Arrays.stream(handle.getClass().getMethods()).filter(method -> method.isAnnotationPresent(ButtonCallback.class)).toList(); - if(commands.isEmpty() && buttons.isEmpty()) return; + List<Method> selectMenus = Arrays.stream(handle.getClass().getMethods()).filter(method -> method.isAnnotationPresent(SelectMenuCallback.class)).toList(); + if(commands.isEmpty() && buttons.isEmpty() && selectMenus.isEmpty()) return; HANDLES.put(handle.getClass().getName(), handle); commands.forEach(this::registerCommand); buttons.forEach(this::registerButton); + selectMenus.forEach(this::registerSelectMenu); } private void registerCommand(Method method){ @@ -77,6 +81,12 @@ public class Register { BUTTON_CALLBACKS.put(callback.name(), method); } + private void registerSelectMenu(Method method){ + SelectMenuCallback callback = method.getAnnotation(SelectMenuCallback.class); + if(SELECT_MENU_CALLBACKS.containsKey(callback.name())) return; + SELECT_MENU_CALLBACKS.put(callback.name(), method); + } + public Method getCommand(String name){ return COMMAND_CALLBACKS.get(name); } @@ -85,6 +95,10 @@ public class Register { return BUTTON_CALLBACKS.get(name); } + public Method getSelectMenuCallback(String name){ + return SELECT_MENU_CALLBACKS.get(name); + } + public Permission getPermission(String name){ return PERMISSIONS.get(name); } diff --git a/src/main/java/net/tylermurphy/ken/event/Responder.java b/src/main/java/net/tylermurphy/ken/command/Responder.java index ba1d587..75f685b 100644 --- a/src/main/java/net/tylermurphy/ken/event/Responder.java +++ b/src/main/java/net/tylermurphy/ken/command/Responder.java @@ -1,4 +1,4 @@ -package net.tylermurphy.ken.event; +package net.tylermurphy.ken.command; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.JDA; @@ -8,11 +8,18 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; +import net.dv8tion.jda.api.events.interaction.component.SelectMenuInteractionEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.interactions.InteractionHook; import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback; import net.dv8tion.jda.api.interactions.commands.OptionMapping; +import net.dv8tion.jda.api.interactions.components.ActionComponent; +import net.dv8tion.jda.api.interactions.components.ActionRow; +import net.dv8tion.jda.api.interactions.components.LayoutComponent; import net.dv8tion.jda.api.interactions.components.buttons.Button; +import net.dv8tion.jda.api.interactions.components.selections.SelectMenu; +import net.dv8tion.jda.api.interactions.components.selections.SelectOption; +import net.dv8tion.jda.api.requests.restaction.WebhookMessageEditAction; import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction; import net.dv8tion.jda.api.utils.FileUpload; import net.tylermurphy.ken.Ken; @@ -44,9 +51,11 @@ public class Responder extends ListenerAdapter { new Eject(), new AddRole(), new DeleteRole(), + new AddRolesPage(), + new DeleteRolesPage(), + new Roles(), new Help(), new Purge(), - new Roles(), new ForceSkip(), new Join(), new Leave(), @@ -140,9 +149,6 @@ public class Responder extends ListenerAdapter { final String invoke = event.getComponentId().toLowerCase(Locale.ROOT).split("_")[0]; Method method = register.getButtonCallback(invoke); - // Defer Reply - event.deferEdit().queue(); - // Get parameters to send to Method Object[] parameters = new Object[method.getParameterTypes().length]; Class<?>[] types = method.getParameterTypes(); @@ -168,6 +174,7 @@ public class Responder extends ListenerAdapter { try { Object temp = method.invoke(register.getHandle(method.getDeclaringClass().getName()), parameters); Response response = (Response) temp; + event.deferEdit().queue(); edit(response, event.getHook()); } catch (Exception e) { EmbedBuilder builder = Ken.getInstance().getDefaultEmbed() @@ -179,6 +186,53 @@ public class Responder extends ListenerAdapter { } + public void onSelectMenuInteraction(SelectMenuInteractionEvent event) { + + // Make sure the Bot can Talk + if(!event.getChannel().canTalk()) return; + // Bots are not allowed to use commands + if (event.getMember() == null || event.getUser().isBot()) return; + + // Get Command Information From Invoke + final String invoke = event.getComponentId().toLowerCase(Locale.ROOT).split("_")[0]; + Method method = register.getSelectMenuCallback(invoke); + + // Get parameters to send to Method + Object[] parameters = new Object[method.getParameterTypes().length]; + Class<?>[] types = method.getParameterTypes(); + for(int i = 0; i < types.length; i++){ + if(types[i] == Member.class){ + parameters[i] = event.getMember(); + } else if(types[i] == GuildMessageChannel.class){ + parameters[i] = event.getGuildChannel(); + } else if(types[i] == Guild.class) { + parameters[i] = event.getGuild(); + } else if(types[i] == SelectMenu.class) { + parameters[i] = event.getSelectMenu(); + } else if(types[i] == Message.class) { + parameters[i] = event.getMessage(); + } else if(types[i] == String.class){ + parameters[i] = event.getValues().get(0); + } else { + parameters[i] = null; + } + } + + // Invoke Method and Respond to User + try { + Object temp = method.invoke(register.getHandle(method.getDeclaringClass().getName()), parameters); + Response response = (Response) temp; + reply(response, event); + } catch (Exception e) { + EmbedBuilder builder = Ken.getInstance().getDefaultEmbed() + .setColor(Color.RED) + .setTitle(":x: **Error**") + .setDescription(e.getCause().getMessage()); + event.getHook().editOriginalEmbeds(builder.build()).queue(); + } + + } + private void reply(Response response, IReplyCallback event){ if(response.error()) { EmbedBuilder builder = Ken.getInstance().getDefaultEmbed() @@ -193,8 +247,9 @@ public class Responder extends ListenerAdapter { message = event.reply(response.getMessage()); } if(response.hasButtons()) message = message.addActionRow(response.getButtons()); + if(response.hasSelectMenu()) message = message.addActionRow(response.getSelectMenu()); if(response.hasFile()) message = message.addFiles(FileUpload.fromData(response.getFile())); - message.queue(); + message.setEphemeral(response.isHidden()).queue(); } } @@ -204,12 +259,20 @@ public class Responder extends ListenerAdapter { .setColor(Color.RED) .setDescription(response.getMessage()); hook.sendMessageEmbeds(builder.build()).queue(); + } else if(response.remove()) { + hook.deleteOriginal().queue(); } else { if(response.hasEmbed()) { hook.editOriginalEmbeds(response.getEmbeds()).queue(); } else { hook.editOriginal(response.getMessage()).queue(); } + if(response.hasSelectMenu() || response.hasButtons()) { + List<LayoutComponent> components = new ArrayList<>(); + if(response.hasButtons()) components.add(ActionRow.of(response.getButtons())); + if(response.hasSelectMenu()) components.add(ActionRow.of(response.getSelectMenu())); + hook.editOriginalComponents(components).queue(); + } } } diff --git a/src/main/java/net/tylermurphy/ken/command/Response.java b/src/main/java/net/tylermurphy/ken/command/Response.java index 6f6b339..ff69cda 100644 --- a/src/main/java/net/tylermurphy/ken/command/Response.java +++ b/src/main/java/net/tylermurphy/ken/command/Response.java @@ -2,6 +2,7 @@ package net.tylermurphy.ken.command; import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.interactions.components.buttons.Button; +import net.dv8tion.jda.api.interactions.components.selections.SelectMenu; import java.io.File; import java.util.ArrayList; @@ -14,14 +15,18 @@ public class Response { private final String type; private final MessageEmbed[] embeds; private final List<Button> buttons; + private final SelectMenu.Builder menu; private final File file; + private boolean hidden = false; + private Response(String type, String message, File file, MessageEmbed... embed){ this.type = type; this.message = message; this.embeds = embed; this.file = file; this.buttons = new ArrayList<>(); + menu = SelectMenu.create("null"); } public static Response error(String message){ @@ -62,6 +67,19 @@ public class Response { return this; } + public Response addSelectMenu(String callback, String id, List<String> options){ + menu.setId(callback + "_" + id); + for(int i=0; i<options.size(); i = i + 2) { + menu.addOption(options.get(i), options.get(i+1)); + } + return this; + } + + public Response setHidden(boolean hidden){ + this.hidden = hidden; + return this; + } + public boolean error(){ return type.equals("error"); } @@ -74,12 +92,20 @@ public class Response { public boolean hasButtons() { return !buttons.isEmpty(); } + public boolean hasSelectMenu() { return !menu.getId().equals("null"); } + + public boolean isHidden() { return hidden; } + public Button[] getButtons() { Button[] arr = new Button[buttons.size()]; arr = buttons.toArray(arr); return arr; } + public SelectMenu getSelectMenu(){ + return menu.build(); + } + public File getFile(){ return file; } diff --git a/src/main/java/net/tylermurphy/ken/event/annotation/ButtonCallback.java b/src/main/java/net/tylermurphy/ken/command/annotation/ButtonCallback.java index 7b791cb..16fb4d7 100644 --- a/src/main/java/net/tylermurphy/ken/event/annotation/ButtonCallback.java +++ b/src/main/java/net/tylermurphy/ken/command/annotation/ButtonCallback.java @@ -1,4 +1,4 @@ -package net.tylermurphy.ken.event.annotation; +package net.tylermurphy.ken.command.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/net/tylermurphy/ken/event/annotation/Command.java b/src/main/java/net/tylermurphy/ken/command/annotation/Command.java index ba6a5b7..a084635 100644 --- a/src/main/java/net/tylermurphy/ken/event/annotation/Command.java +++ b/src/main/java/net/tylermurphy/ken/command/annotation/Command.java @@ -1,4 +1,4 @@ -package net.tylermurphy.ken.event.annotation; +package net.tylermurphy.ken.command.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/net/tylermurphy/ken/event/annotation/Option.java b/src/main/java/net/tylermurphy/ken/command/annotation/Option.java index 0b91431..d4bc285 100644 --- a/src/main/java/net/tylermurphy/ken/event/annotation/Option.java +++ b/src/main/java/net/tylermurphy/ken/command/annotation/Option.java @@ -1,4 +1,4 @@ -package net.tylermurphy.ken.event.annotation; +package net.tylermurphy.ken.command.annotation; import net.dv8tion.jda.api.interactions.commands.OptionType; diff --git a/src/main/java/net/tylermurphy/ken/event/annotation/Options.java b/src/main/java/net/tylermurphy/ken/command/annotation/Options.java index ed5f6e8..c383600 100644 --- a/src/main/java/net/tylermurphy/ken/event/annotation/Options.java +++ b/src/main/java/net/tylermurphy/ken/command/annotation/Options.java @@ -1,4 +1,4 @@ -package net.tylermurphy.ken.event.annotation; +package net.tylermurphy.ken.command.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/net/tylermurphy/ken/event/annotation/Requirement.java b/src/main/java/net/tylermurphy/ken/command/annotation/Requirement.java index 7cce41e..d071d13 100644 --- a/src/main/java/net/tylermurphy/ken/event/annotation/Requirement.java +++ b/src/main/java/net/tylermurphy/ken/command/annotation/Requirement.java @@ -1,4 +1,4 @@ -package net.tylermurphy.ken.event.annotation; +package net.tylermurphy.ken.command.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/net/tylermurphy/ken/command/annotation/SelectMenuCallback.java b/src/main/java/net/tylermurphy/ken/command/annotation/SelectMenuCallback.java new file mode 100644 index 0000000..ced3750 --- /dev/null +++ b/src/main/java/net/tylermurphy/ken/command/annotation/SelectMenuCallback.java @@ -0,0 +1,12 @@ +package net.tylermurphy.ken.command.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface SelectMenuCallback { + String name(); +} diff --git a/src/main/java/net/tylermurphy/ken/event/annotation/Selection.java b/src/main/java/net/tylermurphy/ken/command/annotation/Selection.java index e73cc0f..e97f810 100644 --- a/src/main/java/net/tylermurphy/ken/event/annotation/Selection.java +++ b/src/main/java/net/tylermurphy/ken/command/annotation/Selection.java @@ -1,4 +1,4 @@ -package net.tylermurphy.ken.event.annotation; +package net.tylermurphy.ken.command.annotation; import net.dv8tion.jda.api.interactions.commands.OptionType; diff --git a/src/main/java/net/tylermurphy/ken/event/annotation/Selections.java b/src/main/java/net/tylermurphy/ken/command/annotation/Selections.java index 5dc8dac..b80c045 100644 --- a/src/main/java/net/tylermurphy/ken/event/annotation/Selections.java +++ b/src/main/java/net/tylermurphy/ken/command/annotation/Selections.java @@ -1,4 +1,4 @@ -package net.tylermurphy.ken.event.annotation; +package net.tylermurphy.ken.command.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/net/tylermurphy/ken/command/fun/Coinflip.java b/src/main/java/net/tylermurphy/ken/command/fun/Coinflip.java index e2e9485..d2522c4 100644 --- a/src/main/java/net/tylermurphy/ken/command/fun/Coinflip.java +++ b/src/main/java/net/tylermurphy/ken/command/fun/Coinflip.java @@ -4,7 +4,7 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Member; import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; public class Coinflip { diff --git a/src/main/java/net/tylermurphy/ken/command/fun/Dice.java b/src/main/java/net/tylermurphy/ken/command/fun/Dice.java index 27e7fd2..e6d711c 100644 --- a/src/main/java/net/tylermurphy/ken/command/fun/Dice.java +++ b/src/main/java/net/tylermurphy/ken/command/fun/Dice.java @@ -4,8 +4,8 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import net.tylermurphy.ken.command.Response; import java.util.List; diff --git a/src/main/java/net/tylermurphy/ken/command/fun/Eject.java b/src/main/java/net/tylermurphy/ken/command/fun/Eject.java index ff06b4f..a7d74eb 100644 --- a/src/main/java/net/tylermurphy/ken/command/fun/Eject.java +++ b/src/main/java/net/tylermurphy/ken/command/fun/Eject.java @@ -2,8 +2,8 @@ package net.tylermurphy.ken.command.fun; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.interactions.commands.OptionType; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.image.GifFactory; diff --git a/src/main/java/net/tylermurphy/ken/command/main/AddRole.java b/src/main/java/net/tylermurphy/ken/command/main/AddRole.java index d5e9f24..4aefa9a 100644 --- a/src/main/java/net/tylermurphy/ken/command/main/AddRole.java +++ b/src/main/java/net/tylermurphy/ken/command/main/AddRole.java @@ -6,10 +6,11 @@ import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; -import net.tylermurphy.ken.event.annotation.Requirement; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; +import net.tylermurphy.ken.command.annotation.Requirement; import org.json.JSONArray; +import org.json.JSONObject; import java.util.List; @@ -17,7 +18,7 @@ public class AddRole { @Command(name="addrole", description="Add a role to the /rolls command on a certain page") @Option(name="role", description="Role to add", type=OptionType.ROLE, required=true) - @Option(name="page#", description="Page to add it on", type=OptionType.INTEGER, required=true) + @Option(name="page", description="Page to add it on", type=OptionType.INTEGER, required=true) @Requirement(Permission.MANAGE_SERVER) public Response execute(Guild guild, List<Object> args) { int page = (int)args.get(1); @@ -26,19 +27,31 @@ public class AddRole { if(data == null){ return Response.error("Page "+page+" does not exist. Please add it with /addrolespage"); } - JSONArray array = new JSONArray(data); - for(Object o : array){ - if((long) o == role.getIdLong()) return Response.error("Role is already on that page"); + JSONObject object = new JSONObject(data); + JSONArray array = object.getJSONArray("roles"); + int index = getIndex(array, role); + if(index != -1){ + return Response.error("Role is already in this page"); } if(array.length() == 15) return Response.error("Each page has a max of 15 roles"); - array.put(role.getId()); - data = array.toString(); + array.put(role.getIdLong()); + object.put("roles", array); + data = object.toString(); boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), page, data); if(result){ - return Response.success("Added "+ role +" to page "+page+" successfully"); + return Response.success("Added "+ role.getAsMention() +" to page "+page+" successfully"); } else { return Response.error("Failed to add role to page"); } } + private int getIndex(JSONArray array, Role role){ + int i = 0; + for(Object o : array){ + if((long) o == role.getIdLong()) return i; + i++; + } + return -1; + } + } diff --git a/src/main/java/net/tylermurphy/ken/command/main/AddRolesPage.java b/src/main/java/net/tylermurphy/ken/command/main/AddRolesPage.java index 2fbab69..b29daeb 100644 --- a/src/main/java/net/tylermurphy/ken/command/main/AddRolesPage.java +++ b/src/main/java/net/tylermurphy/ken/command/main/AddRolesPage.java @@ -5,9 +5,9 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; -import net.tylermurphy.ken.event.annotation.Requirement; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; +import net.tylermurphy.ken.command.annotation.Requirement; import org.json.JSONArray; import org.json.JSONObject; @@ -20,18 +20,19 @@ public class AddRolesPage { @Option(name="description", description="Description of the page", type=OptionType.STRING, required=true) @Requirement(Permission.MANAGE_SERVER) public Response execute(Guild guild, List<Object> args){ - String data = Ken.getInstance().getDatabase().getSelfRoleData().getData(guild.getIdLong(), 0); - JSONArray array; - if(data == null) array = new JSONArray(); - else array = new JSONArray(data); + int pages = Ken.getInstance().getDatabase().getSelfRoleData().getPages(guild.getIdLong()); + if(pages == -1){ + return Response.error("Failed to get database data"); + } JSONObject page = new JSONObject(); + JSONArray array = new JSONArray(); + page.put("roles", array); page.put("title", args.get(0)); page.put("description", args.get(1)); - array.put(page); - data = array.toString(); - boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), 0, data); + String data = page.toString(); + boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), pages+1, data); if(result){ - return Response.success("Added new page called "+args.get(0)+" successfully"); + return Response.success("Added new page called `"+args.get(0)+"` successfully"); } else { return Response.error("Failed to create page"); } diff --git a/src/main/java/net/tylermurphy/ken/command/main/DeleteRole.java b/src/main/java/net/tylermurphy/ken/command/main/DeleteRole.java index 9a271ea..9d39a50 100644 --- a/src/main/java/net/tylermurphy/ken/command/main/DeleteRole.java +++ b/src/main/java/net/tylermurphy/ken/command/main/DeleteRole.java @@ -6,10 +6,11 @@ import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; -import net.tylermurphy.ken.event.annotation.Requirement; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; +import net.tylermurphy.ken.command.annotation.Requirement; import org.json.JSONArray; +import org.json.JSONObject; import java.util.List; @@ -17,7 +18,7 @@ public class DeleteRole { @Command(name="deleterole", description="Delete a role from the /rolls command on a certain page") @Option(name="role", description="Role to delete", type= OptionType.ROLE, required=true) - @Option(name="page#", description="Page to remove it from", type=OptionType.INTEGER, required=true) + @Option(name="page", description="Page to remove it from", type=OptionType.INTEGER, required=true) @Requirement(Permission.MANAGE_SERVER) public Response execute(Guild guild, List<Object> args) { int page = (int)args.get(1); @@ -26,16 +27,18 @@ public class DeleteRole { if(data == null){ return Response.error("Page "+page+" does not exist."); } - JSONArray array = new JSONArray(data); + JSONObject object = new JSONObject(data); + JSONArray array = object.getJSONArray("roles"); int index = getIndex(array, role); if(index == -1){ - return Response.error("Role is not that page"); + return Response.error("Role is not on that page"); } array.remove(index); - data = array.toString(); + object.put("roles", array); + data = object.toString(); boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), page, data); if(result){ - return Response.success("Removed "+ role +" from page "+page+" successfully"); + return Response.success("Removed "+ role.getAsMention() +" from page "+page+" successfully"); } else { return Response.error("Failed to remove role from page"); } diff --git a/src/main/java/net/tylermurphy/ken/command/main/DeleteRolesPage.java b/src/main/java/net/tylermurphy/ken/command/main/DeleteRolesPage.java index 22ee85d..76128fd 100644 --- a/src/main/java/net/tylermurphy/ken/command/main/DeleteRolesPage.java +++ b/src/main/java/net/tylermurphy/ken/command/main/DeleteRolesPage.java @@ -1,4 +1,35 @@ package net.tylermurphy.ken.command.main; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.interactions.commands.OptionType; +import net.tylermurphy.ken.Ken; +import net.tylermurphy.ken.command.Response; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; +import net.tylermurphy.ken.command.annotation.Requirement; +import org.json.JSONObject; + +import java.util.List; + public class DeleteRolesPage { + + @Command(name="deleterolespage", description="Deletes a page from the /rolls command") + @Option(name="page", description="Page number to delete", type= OptionType.INTEGER, required=true) + @Requirement(Permission.MANAGE_SERVER) + public Response execute(Guild guild, List<Object> args){ + int page = (int)args.get(0); + String data = Ken.getInstance().getDatabase().getSelfRoleData().getData(guild.getIdLong(), page); + if(data == null){ + return Response.error("Page does not exist"); + } + String name = new JSONObject(data).getString("title"); + boolean result = Ken.getInstance().getDatabase().getSelfRoleData().deleteData(guild.getIdLong(), page); + if(result){ + return Response.success("Deleted page `"+name+"` successfully"); + } else { + return Response.error("Failed to delete page"); + } + } + } diff --git a/src/main/java/net/tylermurphy/ken/command/main/Help.java b/src/main/java/net/tylermurphy/ken/command/main/Help.java index 18f432f..4970823 100644 --- a/src/main/java/net/tylermurphy/ken/command/main/Help.java +++ b/src/main/java/net/tylermurphy/ken/command/main/Help.java @@ -5,8 +5,8 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.MessageEmbed; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.ButtonCallback; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.ButtonCallback; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; public class Help { diff --git a/src/main/java/net/tylermurphy/ken/command/main/Purge.java b/src/main/java/net/tylermurphy/ken/command/main/Purge.java index f285698..1bdabb0 100644 --- a/src/main/java/net/tylermurphy/ken/command/main/Purge.java +++ b/src/main/java/net/tylermurphy/ken/command/main/Purge.java @@ -5,9 +5,9 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.GuildMessageChannel; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.interactions.commands.OptionType; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; -import net.tylermurphy.ken.event.annotation.Requirement; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; +import net.tylermurphy.ken.command.annotation.Requirement; import net.tylermurphy.ken.command.Response; import java.util.List; diff --git a/src/main/java/net/tylermurphy/ken/command/main/Roles.java b/src/main/java/net/tylermurphy/ken/command/main/Roles.java index 18403f9..0726b11 100644 --- a/src/main/java/net/tylermurphy/ken/command/main/Roles.java +++ b/src/main/java/net/tylermurphy/ken/command/main/Roles.java @@ -1,4 +1,96 @@ package net.tylermurphy.ken.command.main; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.interactions.components.selections.SelectMenu; +import net.tylermurphy.ken.Ken; +import net.tylermurphy.ken.command.Response; +import net.tylermurphy.ken.command.annotation.ButtonCallback; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.SelectMenuCallback; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + public class Roles { + + @Command(name="roles",description="Self add roles to yourself") + public Response execute(Guild guild){ + String data = Ken.getInstance().getDatabase().getSelfRoleData().getData(guild.getIdLong(), 1); + if(data==null){ + return Response.error("Self roles are currently not setup in this server"); + } + int pages = Ken.getInstance().getDatabase().getSelfRoleData().getPages(guild.getIdLong()); + return Response.success(getEmbed(data, 1, pages)).addSecondaryButton("roles", "previous", "Previous").addSecondaryButton("roles", "next", "Next").addDangerButton("roles","exit","Exit").addSelectMenu("roles","select",getRoles(data)); + } + + @ButtonCallback(name="roles") + public Response onButton(Guild guild, String id, Message message){ + int page; + if(message == null || id.equals("exit")) return Response.delete(); + if (message.getEmbeds().size() > 0 && message.getEmbeds().get(0) != null) { + page = Integer.parseInt(message.getEmbeds().get(0).getFooter().getText().split("/")[0].substring(5)); + } else { + page = 1; + } + int pages = Ken.getInstance().getDatabase().getSelfRoleData().getPages(guild.getIdLong()); + if(id.equals("previous")) + page = page - 1 < 1 ? pages : page - 1; + else + page = page + 1 > pages ? 1 : page + 1; + String data = Ken.getInstance().getDatabase().getSelfRoleData().getData(guild.getIdLong(), page); + if(data==null){ + return Response.error("Self roles are currently not setup in this server"); + } + return Response.success(getEmbed(data, page, pages)).addSecondaryButton("roles", "previous", "Previous").addSecondaryButton("roles", "next", "Next").addDangerButton("roles","exit","Exit").addSelectMenu("roles","select",getRoles(data)); + } + + @SelectMenuCallback(name="roles") + public Response onSelect(String choice, Member sender, Guild guild){ + long id = Long.parseLong(choice); + Role role = Ken.getInstance().getRoleById(id); + try { + if (sender.getRoles().contains(role)) { + guild.removeRoleFromMember(sender, role).queue(); + return Response.success(":white_check_mark: Successfully removed role "+role.getAsMention()).setHidden(true); + } else { + guild.addRoleToMember(sender, role).queue(); + return Response.success(":white_check_mark: Successfully added role "+role.getAsMention()).setHidden(true); + } + } catch (Exception e){ + return Response.error("There was an error adding or removing the role. Make sure I have permission to do so"); + } + } + + private MessageEmbed getEmbed(String data, int page, int pages){ + JSONObject json = new JSONObject(data); + JSONArray roles = json.getJSONArray("roles"); + EmbedBuilder embed = Ken.getInstance().getDefaultEmbed() + .setTitle("Self Roles") + .appendDescription("**"+json.getString("title")+"**\n") + .appendDescription(json.getString("description")+"\n\n"); + int i = 1; + for(Object object : roles){ + Role role = Ken.getInstance().getRoleById((long)object); + embed.appendDescription(String.format("`%s`: %s\n", i, role.getAsMention())); + i++; + } + embed.setFooter("Page "+page+"/"+pages); + return embed.build(); + } + + private List<String> getRoles(String data){ + JSONObject json = new JSONObject(data); + JSONArray roles = json.getJSONArray("roles"); + List<String> result = new ArrayList<>(); + for(Object object : roles){ + Role role = Ken.getInstance().getRoleById((long)object); + result.add(role.getName()); + result.add(role.getId()); + } + return result; + } + } diff --git a/src/main/java/net/tylermurphy/ken/command/music/ForceSkip.java b/src/main/java/net/tylermurphy/ken/command/music/ForceSkip.java index bba7e2a..cf3e6ea 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/ForceSkip.java +++ b/src/main/java/net/tylermurphy/ken/command/music/ForceSkip.java @@ -5,7 +5,7 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Join.java b/src/main/java/net/tylermurphy/ken/command/music/Join.java index 64fd20d..b1dfa75 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Join.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Join.java @@ -4,7 +4,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Leave.java b/src/main/java/net/tylermurphy/ken/command/music/Leave.java index 5f9b0be..5455554 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Leave.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Leave.java @@ -4,7 +4,7 @@ import net.dv8tion.jda.api.entities.AudioChannel; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.managers.AudioManager; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Loop.java b/src/main/java/net/tylermurphy/ken/command/music/Loop.java index d7eb65f..bee99d7 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Loop.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Loop.java @@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/music/LoopQueue.java b/src/main/java/net/tylermurphy/ken/command/music/LoopQueue.java index 3cdff39..02d6432 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/LoopQueue.java +++ b/src/main/java/net/tylermurphy/ken/command/music/LoopQueue.java @@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/music/NowPlaying.java b/src/main/java/net/tylermurphy/ken/command/music/NowPlaying.java index ea36dd3..24aaa5e 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/NowPlaying.java +++ b/src/main/java/net/tylermurphy/ken/command/music/NowPlaying.java @@ -6,7 +6,7 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.PlayerManager; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Pause.java b/src/main/java/net/tylermurphy/ken/command/music/Pause.java index bdba5bf..d1e6e32 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Pause.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Pause.java @@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Play.java b/src/main/java/net/tylermurphy/ken/command/music/Play.java index c1f25da..554b8dc 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Play.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Play.java @@ -6,8 +6,8 @@ import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.PlayerManager; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Queue.java b/src/main/java/net/tylermurphy/ken/command/music/Queue.java index 98d1a0e..b752985 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Queue.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Queue.java @@ -7,8 +7,8 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.MessageEmbed; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.ButtonCallback; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.ButtonCallback; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.PlayerManager; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Remove.java b/src/main/java/net/tylermurphy/ken/command/music/Remove.java index f414420..d122bbb 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Remove.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Remove.java @@ -7,8 +7,8 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Resume.java b/src/main/java/net/tylermurphy/ken/command/music/Resume.java index 68d8111..47595d2 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Resume.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Resume.java @@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Skip.java b/src/main/java/net/tylermurphy/ken/command/music/Skip.java index e16c98b..a017170 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Skip.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Skip.java @@ -8,7 +8,7 @@ import net.dv8tion.jda.api.entities.GuildMessageChannel; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.PlayerManager; diff --git a/src/main/java/net/tylermurphy/ken/command/music/Stop.java b/src/main/java/net/tylermurphy/ken/command/music/Stop.java index c7df165..1c96c0b 100644 --- a/src/main/java/net/tylermurphy/ken/command/music/Stop.java +++ b/src/main/java/net/tylermurphy/ken/command/music/Stop.java @@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.managers.AudioManager; import net.tylermurphy.ken.Ken; -import net.tylermurphy.ken.event.annotation.Command; +import net.tylermurphy.ken.command.annotation.Command; import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.MusicPermissions; diff --git a/src/main/java/net/tylermurphy/ken/command/nsfw/Danbooru.java b/src/main/java/net/tylermurphy/ken/command/nsfw/Danbooru.java index ca18be9..fd91ae1 100644 --- a/src/main/java/net/tylermurphy/ken/command/nsfw/Danbooru.java +++ b/src/main/java/net/tylermurphy/ken/command/nsfw/Danbooru.java @@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.JsonRequest; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; diff --git a/src/main/java/net/tylermurphy/ken/command/nsfw/E621.java b/src/main/java/net/tylermurphy/ken/command/nsfw/E621.java index 580e1d2..1448083 100644 --- a/src/main/java/net/tylermurphy/ken/command/nsfw/E621.java +++ b/src/main/java/net/tylermurphy/ken/command/nsfw/E621.java @@ -6,8 +6,8 @@ import net.dv8tion.jda.api.interactions.commands.OptionType; import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.JsonRequest; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import net.tylermurphy.ken.command.Response; import org.json.JSONArray; import org.json.JSONException; diff --git a/src/main/java/net/tylermurphy/ken/command/nsfw/Gelbooru.java b/src/main/java/net/tylermurphy/ken/command/nsfw/Gelbooru.java index 167cc2f..54cc042 100644 --- a/src/main/java/net/tylermurphy/ken/command/nsfw/Gelbooru.java +++ b/src/main/java/net/tylermurphy/ken/command/nsfw/Gelbooru.java @@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.XmlRequest; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import org.json.JSONException; import org.w3c.dom.Document; import org.w3c.dom.Element; diff --git a/src/main/java/net/tylermurphy/ken/command/nsfw/Hentai.java b/src/main/java/net/tylermurphy/ken/command/nsfw/Hentai.java index 00ec51d..5141b9d 100644 --- a/src/main/java/net/tylermurphy/ken/command/nsfw/Hentai.java +++ b/src/main/java/net/tylermurphy/ken/command/nsfw/Hentai.java @@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.JsonRequest; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Selection; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Selection; import org.json.JSONException; import org.json.JSONObject; diff --git a/src/main/java/net/tylermurphy/ken/command/nsfw/Konachan.java b/src/main/java/net/tylermurphy/ken/command/nsfw/Konachan.java index cb852a8..44afb4b 100644 --- a/src/main/java/net/tylermurphy/ken/command/nsfw/Konachan.java +++ b/src/main/java/net/tylermurphy/ken/command/nsfw/Konachan.java @@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.XmlRequest; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import org.json.JSONException; import org.w3c.dom.Document; import org.w3c.dom.Element; diff --git a/src/main/java/net/tylermurphy/ken/command/nsfw/Rule34.java b/src/main/java/net/tylermurphy/ken/command/nsfw/Rule34.java index 9c0a264..f233267 100644 --- a/src/main/java/net/tylermurphy/ken/command/nsfw/Rule34.java +++ b/src/main/java/net/tylermurphy/ken/command/nsfw/Rule34.java @@ -6,8 +6,8 @@ import net.dv8tion.jda.api.interactions.commands.OptionType; import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.XmlRequest; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import net.tylermurphy.ken.command.Response; import org.json.JSONException; import org.w3c.dom.Document; diff --git a/src/main/java/net/tylermurphy/ken/command/nsfw/Yandere.java b/src/main/java/net/tylermurphy/ken/command/nsfw/Yandere.java index 3f7b61a..f9475d4 100644 --- a/src/main/java/net/tylermurphy/ken/command/nsfw/Yandere.java +++ b/src/main/java/net/tylermurphy/ken/command/nsfw/Yandere.java @@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.XmlRequest; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import org.json.JSONException; import org.w3c.dom.Document; import org.w3c.dom.Element; diff --git a/src/main/java/net/tylermurphy/ken/command/nsfw/nHentai.java b/src/main/java/net/tylermurphy/ken/command/nsfw/nHentai.java index 3b51eea..776e470 100644 --- a/src/main/java/net/tylermurphy/ken/command/nsfw/nHentai.java +++ b/src/main/java/net/tylermurphy/ken/command/nsfw/nHentai.java @@ -9,9 +9,9 @@ import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.JsonRequest; import net.tylermurphy.ken.command.Response; -import net.tylermurphy.ken.event.annotation.ButtonCallback; -import net.tylermurphy.ken.event.annotation.Command; -import net.tylermurphy.ken.event.annotation.Option; +import net.tylermurphy.ken.command.annotation.ButtonCallback; +import net.tylermurphy.ken.command.annotation.Command; +import net.tylermurphy.ken.command.annotation.Option; import org.json.JSONArray; import org.json.JSONObject; |