This commit is contained in:
Tyler Murphy 2022-08-25 11:21:01 -04:00
parent 14e9087dfa
commit 33f0ab31b1
43 changed files with 346 additions and 88 deletions

View file

@ -7,10 +7,11 @@ import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Activity; 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.hooks.ListenerAdapter;
import net.dv8tion.jda.api.requests.GatewayIntent; import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.utils.MemberCachePolicy; 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.database.Database;
import net.tylermurphy.ken.music.PlayerManager; import net.tylermurphy.ken.music.PlayerManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -90,6 +91,8 @@ public class Ken {
public Database getDatabase() { return database; } public Database getDatabase() { return database; }
public Role getRoleById(long id) { return api.getRoleById(id); }
public EmbedBuilder getDefaultEmbed() { public EmbedBuilder getDefaultEmbed() {
EmbedBuilder builder = new EmbedBuilder(); EmbedBuilder builder = new EmbedBuilder();
builder.setColor(new Color( builder.setColor(new Color(

View file

@ -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.Commands;
import net.dv8tion.jda.api.interactions.commands.build.OptionData; import net.dv8tion.jda.api.interactions.commands.build.OptionData;
import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData; 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.lang.reflect.Method;
import java.util.*; import java.util.*;
@ -15,6 +15,7 @@ public class Register {
private final Map<String, Object> HANDLES; private final Map<String, Object> HANDLES;
private final Map<String, Method> COMMAND_CALLBACKS; private final Map<String, Method> COMMAND_CALLBACKS;
private final Map<String, Method> BUTTON_CALLBACKS; private final Map<String, Method> BUTTON_CALLBACKS;
private final Map<String, Method> SELECT_MENU_CALLBACKS;
private final Map<String, Permission> PERMISSIONS; private final Map<String, Permission> PERMISSIONS;
private final JDA api; private final JDA api;
@ -23,6 +24,7 @@ public class Register {
HANDLES = new HashMap<>(); HANDLES = new HashMap<>();
COMMAND_CALLBACKS = new HashMap<>(); COMMAND_CALLBACKS = new HashMap<>();
BUTTON_CALLBACKS = new HashMap<>(); BUTTON_CALLBACKS = new HashMap<>();
SELECT_MENU_CALLBACKS = new HashMap<>();
PERMISSIONS = new HashMap<>(); PERMISSIONS = new HashMap<>();
this.api = api; this.api = api;
@ -32,10 +34,12 @@ public class Register {
if(HANDLES.containsKey(handle.getClass().getName())) return; if(HANDLES.containsKey(handle.getClass().getName())) return;
List<Method> commands = Arrays.stream(handle.getClass().getMethods()).filter(method -> method.isAnnotationPresent(Command.class)).toList(); 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(); 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); HANDLES.put(handle.getClass().getName(), handle);
commands.forEach(this::registerCommand); commands.forEach(this::registerCommand);
buttons.forEach(this::registerButton); buttons.forEach(this::registerButton);
selectMenus.forEach(this::registerSelectMenu);
} }
private void registerCommand(Method method){ private void registerCommand(Method method){
@ -77,6 +81,12 @@ public class Register {
BUTTON_CALLBACKS.put(callback.name(), method); 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){ public Method getCommand(String name){
return COMMAND_CALLBACKS.get(name); return COMMAND_CALLBACKS.get(name);
} }
@ -85,6 +95,10 @@ public class Register {
return BUTTON_CALLBACKS.get(name); return BUTTON_CALLBACKS.get(name);
} }
public Method getSelectMenuCallback(String name){
return SELECT_MENU_CALLBACKS.get(name);
}
public Permission getPermission(String name){ public Permission getPermission(String name){
return PERMISSIONS.get(name); return PERMISSIONS.get(name);
} }

View file

@ -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.EmbedBuilder;
import net.dv8tion.jda.api.JDA; 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.entities.Message;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; 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.ButtonInteractionEvent;
import net.dv8tion.jda.api.events.interaction.component.SelectMenuInteractionEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.InteractionHook; import net.dv8tion.jda.api.interactions.InteractionHook;
import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback; import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback;
import net.dv8tion.jda.api.interactions.commands.OptionMapping; 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.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.requests.restaction.interactions.ReplyCallbackAction;
import net.dv8tion.jda.api.utils.FileUpload; import net.dv8tion.jda.api.utils.FileUpload;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
@ -44,9 +51,11 @@ public class Responder extends ListenerAdapter {
new Eject(), new Eject(),
new AddRole(), new AddRole(),
new DeleteRole(), new DeleteRole(),
new AddRolesPage(),
new DeleteRolesPage(),
new Roles(),
new Help(), new Help(),
new Purge(), new Purge(),
new Roles(),
new ForceSkip(), new ForceSkip(),
new Join(), new Join(),
new Leave(), new Leave(),
@ -140,9 +149,6 @@ public class Responder extends ListenerAdapter {
final String invoke = event.getComponentId().toLowerCase(Locale.ROOT).split("_")[0]; final String invoke = event.getComponentId().toLowerCase(Locale.ROOT).split("_")[0];
Method method = register.getButtonCallback(invoke); Method method = register.getButtonCallback(invoke);
// Defer Reply
event.deferEdit().queue();
// Get parameters to send to Method // Get parameters to send to Method
Object[] parameters = new Object[method.getParameterTypes().length]; Object[] parameters = new Object[method.getParameterTypes().length];
Class<?>[] types = method.getParameterTypes(); Class<?>[] types = method.getParameterTypes();
@ -168,6 +174,7 @@ public class Responder extends ListenerAdapter {
try { try {
Object temp = method.invoke(register.getHandle(method.getDeclaringClass().getName()), parameters); Object temp = method.invoke(register.getHandle(method.getDeclaringClass().getName()), parameters);
Response response = (Response) temp; Response response = (Response) temp;
event.deferEdit().queue();
edit(response, event.getHook()); edit(response, event.getHook());
} catch (Exception e) { } catch (Exception e) {
EmbedBuilder builder = Ken.getInstance().getDefaultEmbed() 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){ private void reply(Response response, IReplyCallback event){
if(response.error()) { if(response.error()) {
EmbedBuilder builder = Ken.getInstance().getDefaultEmbed() EmbedBuilder builder = Ken.getInstance().getDefaultEmbed()
@ -193,8 +247,9 @@ public class Responder extends ListenerAdapter {
message = event.reply(response.getMessage()); message = event.reply(response.getMessage());
} }
if(response.hasButtons()) message = message.addActionRow(response.getButtons()); 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())); 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) .setColor(Color.RED)
.setDescription(response.getMessage()); .setDescription(response.getMessage());
hook.sendMessageEmbeds(builder.build()).queue(); hook.sendMessageEmbeds(builder.build()).queue();
} else if(response.remove()) {
hook.deleteOriginal().queue();
} else { } else {
if(response.hasEmbed()) { if(response.hasEmbed()) {
hook.editOriginalEmbeds(response.getEmbeds()).queue(); hook.editOriginalEmbeds(response.getEmbeds()).queue();
} else { } else {
hook.editOriginal(response.getMessage()).queue(); 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();
}
} }
} }

View file

@ -2,6 +2,7 @@ package net.tylermurphy.ken.command;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.interactions.components.buttons.Button; import net.dv8tion.jda.api.interactions.components.buttons.Button;
import net.dv8tion.jda.api.interactions.components.selections.SelectMenu;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -14,14 +15,18 @@ public class Response {
private final String type; private final String type;
private final MessageEmbed[] embeds; private final MessageEmbed[] embeds;
private final List<Button> buttons; private final List<Button> buttons;
private final SelectMenu.Builder menu;
private final File file; private final File file;
private boolean hidden = false;
private Response(String type, String message, File file, MessageEmbed... embed){ private Response(String type, String message, File file, MessageEmbed... embed){
this.type = type; this.type = type;
this.message = message; this.message = message;
this.embeds = embed; this.embeds = embed;
this.file = file; this.file = file;
this.buttons = new ArrayList<>(); this.buttons = new ArrayList<>();
menu = SelectMenu.create("null");
} }
public static Response error(String message){ public static Response error(String message){
@ -62,6 +67,19 @@ public class Response {
return this; 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(){ public boolean error(){
return type.equals("error"); return type.equals("error");
} }
@ -74,12 +92,20 @@ public class Response {
public boolean hasButtons() { return !buttons.isEmpty(); } public boolean hasButtons() { return !buttons.isEmpty(); }
public boolean hasSelectMenu() { return !menu.getId().equals("null"); }
public boolean isHidden() { return hidden; }
public Button[] getButtons() { public Button[] getButtons() {
Button[] arr = new Button[buttons.size()]; Button[] arr = new Button[buttons.size()];
arr = buttons.toArray(arr); arr = buttons.toArray(arr);
return arr; return arr;
} }
public SelectMenu getSelectMenu(){
return menu.build();
}
public File getFile(){ public File getFile(){
return file; return file;
} }

View file

@ -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.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View file

@ -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.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.ken.event.annotation; package net.tylermurphy.ken.command.annotation;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;

View file

@ -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.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View file

@ -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.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View file

@ -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();
}

View file

@ -1,4 +1,4 @@
package net.tylermurphy.ken.event.annotation; package net.tylermurphy.ken.command.annotation;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;

View file

@ -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.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View file

@ -4,7 +4,7 @@ import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
public class Coinflip { public class Coinflip {

View file

@ -4,8 +4,8 @@ import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import java.util.List; import java.util.List;

View file

@ -2,8 +2,8 @@ package net.tylermurphy.ken.command.fun;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.image.GifFactory; import net.tylermurphy.ken.image.GifFactory;

View file

@ -6,10 +6,11 @@ import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.event.annotation.Requirement; import net.tylermurphy.ken.command.annotation.Requirement;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject;
import java.util.List; 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") @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="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) @Requirement(Permission.MANAGE_SERVER)
public Response execute(Guild guild, List<Object> args) { public Response execute(Guild guild, List<Object> args) {
int page = (int)args.get(1); int page = (int)args.get(1);
@ -26,19 +27,31 @@ public class AddRole {
if(data == null){ if(data == null){
return Response.error("Page "+page+" does not exist. Please add it with /addrolespage"); return Response.error("Page "+page+" does not exist. Please add it with /addrolespage");
} }
JSONArray array = new JSONArray(data); JSONObject object = new JSONObject(data);
for(Object o : array){ JSONArray array = object.getJSONArray("roles");
if((long) o == role.getIdLong()) return Response.error("Role is already on that page"); 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"); if(array.length() == 15) return Response.error("Each page has a max of 15 roles");
array.put(role.getId()); array.put(role.getIdLong());
data = array.toString(); object.put("roles", array);
data = object.toString();
boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), page, data); boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), page, data);
if(result){ if(result){
return Response.success("Added "+ role +" to page "+page+" successfully"); return Response.success("Added "+ role.getAsMention() +" to page "+page+" successfully");
} else { } else {
return Response.error("Failed to add role to page"); 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;
}
} }

View file

@ -5,9 +5,9 @@ import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.event.annotation.Requirement; import net.tylermurphy.ken.command.annotation.Requirement;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
@ -20,18 +20,19 @@ public class AddRolesPage {
@Option(name="description", description="Description of the page", type=OptionType.STRING, required=true) @Option(name="description", description="Description of the page", type=OptionType.STRING, required=true)
@Requirement(Permission.MANAGE_SERVER) @Requirement(Permission.MANAGE_SERVER)
public Response execute(Guild guild, List<Object> args){ public Response execute(Guild guild, List<Object> args){
String data = Ken.getInstance().getDatabase().getSelfRoleData().getData(guild.getIdLong(), 0); int pages = Ken.getInstance().getDatabase().getSelfRoleData().getPages(guild.getIdLong());
JSONArray array; if(pages == -1){
if(data == null) array = new JSONArray(); return Response.error("Failed to get database data");
else array = new JSONArray(data); }
JSONObject page = new JSONObject(); JSONObject page = new JSONObject();
JSONArray array = new JSONArray();
page.put("roles", array);
page.put("title", args.get(0)); page.put("title", args.get(0));
page.put("description", args.get(1)); page.put("description", args.get(1));
array.put(page); String data = page.toString();
data = array.toString(); boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), pages+1, data);
boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), 0, data);
if(result){ 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 { } else {
return Response.error("Failed to create page"); return Response.error("Failed to create page");
} }

View file

@ -6,10 +6,11 @@ import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.event.annotation.Requirement; import net.tylermurphy.ken.command.annotation.Requirement;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject;
import java.util.List; 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") @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="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) @Requirement(Permission.MANAGE_SERVER)
public Response execute(Guild guild, List<Object> args) { public Response execute(Guild guild, List<Object> args) {
int page = (int)args.get(1); int page = (int)args.get(1);
@ -26,16 +27,18 @@ public class DeleteRole {
if(data == null){ if(data == null){
return Response.error("Page "+page+" does not exist."); 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); int index = getIndex(array, role);
if(index == -1){ if(index == -1){
return Response.error("Role is not that page"); return Response.error("Role is not on that page");
} }
array.remove(index); array.remove(index);
data = array.toString(); object.put("roles", array);
data = object.toString();
boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), page, data); boolean result = Ken.getInstance().getDatabase().getSelfRoleData().setData(guild.getIdLong(), page, data);
if(result){ if(result){
return Response.success("Removed "+ role +" from page "+page+" successfully"); return Response.success("Removed "+ role.getAsMention() +" from page "+page+" successfully");
} else { } else {
return Response.error("Failed to remove role from page"); return Response.error("Failed to remove role from page");
} }

View file

@ -1,4 +1,35 @@
package net.tylermurphy.ken.command.main; 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 { 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");
}
}
} }

View file

@ -5,8 +5,8 @@ import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.event.annotation.ButtonCallback; import net.tylermurphy.ken.command.annotation.ButtonCallback;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
public class Help { public class Help {

View file

@ -5,9 +5,9 @@ import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.GuildMessageChannel; import net.dv8tion.jda.api.entities.GuildMessageChannel;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.event.annotation.Requirement; import net.tylermurphy.ken.command.annotation.Requirement;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import java.util.List; import java.util.List;

View file

@ -1,4 +1,96 @@
package net.tylermurphy.ken.command.main; 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 { 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;
}
} }

View file

@ -5,7 +5,7 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -4,7 +4,7 @@ import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -4,7 +4,7 @@ import net.dv8tion.jda.api.entities.AudioChannel;
import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.managers.AudioManager; 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.command.Response;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -6,7 +6,7 @@ import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.PlayerManager; import net.tylermurphy.ken.music.PlayerManager;

View file

@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -6,8 +6,8 @@ import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.music.PlayerManager; import net.tylermurphy.ken.music.PlayerManager;

View file

@ -7,8 +7,8 @@ import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.event.annotation.ButtonCallback; import net.tylermurphy.ken.command.annotation.ButtonCallback;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.PlayerManager; import net.tylermurphy.ken.music.PlayerManager;

View file

@ -7,8 +7,8 @@ import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -8,7 +8,7 @@ import net.dv8tion.jda.api.entities.GuildMessageChannel;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.PlayerManager; import net.tylermurphy.ken.music.PlayerManager;

View file

@ -6,7 +6,7 @@ import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.managers.AudioManager; import net.dv8tion.jda.api.managers.AudioManager;
import net.tylermurphy.ken.Ken; 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.command.Response;
import net.tylermurphy.ken.music.GuildMusicManager; import net.tylermurphy.ken.music.GuildMusicManager;
import net.tylermurphy.ken.music.MusicPermissions; import net.tylermurphy.ken.music.MusicPermissions;

View file

@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.HTTPMethod;
import net.tylermurphy.ken.api.JsonRequest; import net.tylermurphy.ken.api.JsonRequest;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -6,8 +6,8 @@ import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.HTTPMethod;
import net.tylermurphy.ken.api.JsonRequest; import net.tylermurphy.ken.api.JsonRequest;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View file

@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.HTTPMethod;
import net.tylermurphy.ken.api.XmlRequest; import net.tylermurphy.ken.api.XmlRequest;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import org.json.JSONException; import org.json.JSONException;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;

View file

@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.HTTPMethod;
import net.tylermurphy.ken.api.JsonRequest; import net.tylermurphy.ken.api.JsonRequest;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Selection; import net.tylermurphy.ken.command.annotation.Selection;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.HTTPMethod;
import net.tylermurphy.ken.api.XmlRequest; import net.tylermurphy.ken.api.XmlRequest;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import org.json.JSONException; import org.json.JSONException;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;

View file

@ -6,8 +6,8 @@ import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.tylermurphy.ken.Ken; import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.HTTPMethod;
import net.tylermurphy.ken.api.XmlRequest; import net.tylermurphy.ken.api.XmlRequest;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import org.json.JSONException; import org.json.JSONException;
import org.w3c.dom.Document; import org.w3c.dom.Document;

View file

@ -7,8 +7,8 @@ import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.HTTPMethod;
import net.tylermurphy.ken.api.XmlRequest; import net.tylermurphy.ken.api.XmlRequest;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import org.json.JSONException; import org.json.JSONException;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;

View file

@ -9,9 +9,9 @@ import net.tylermurphy.ken.Ken;
import net.tylermurphy.ken.api.HTTPMethod; import net.tylermurphy.ken.api.HTTPMethod;
import net.tylermurphy.ken.api.JsonRequest; import net.tylermurphy.ken.api.JsonRequest;
import net.tylermurphy.ken.command.Response; import net.tylermurphy.ken.command.Response;
import net.tylermurphy.ken.event.annotation.ButtonCallback; import net.tylermurphy.ken.command.annotation.ButtonCallback;
import net.tylermurphy.ken.event.annotation.Command; import net.tylermurphy.ken.command.annotation.Command;
import net.tylermurphy.ken.event.annotation.Option; import net.tylermurphy.ken.command.annotation.Option;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;