From 8a7348eebc8145538b0000dab7ec7ecb627ca07c Mon Sep 17 00:00:00 2001 From: tueem Date: Thu, 7 Nov 2024 11:50:52 +0100 Subject: [PATCH] fix class names and add Button Interaction type case --- .../marinare/wrapper/javacord/JavacordWrapper.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/wrapper/javacord/src/main/java/net/tomatentum/marinare/wrapper/javacord/JavacordWrapper.java b/wrapper/javacord/src/main/java/net/tomatentum/marinare/wrapper/javacord/JavacordWrapper.java index 59c7a50..cfece73 100644 --- a/wrapper/javacord/src/main/java/net/tomatentum/marinare/wrapper/javacord/JavacordWrapper.java +++ b/wrapper/javacord/src/main/java/net/tomatentum/marinare/wrapper/javacord/JavacordWrapper.java @@ -14,6 +14,7 @@ import org.javacord.api.interaction.ButtonInteraction; import org.javacord.api.interaction.SlashCommandBuilder; import org.javacord.api.interaction.SlashCommandInteraction; import org.javacord.api.interaction.SlashCommandInteractionOption; +import org.javacord.core.entity.user.Member; import io.leangen.geantyref.AnnotationFormatException; import io.leangen.geantyref.TypeFactory; @@ -40,6 +41,8 @@ public class JavacordWrapper extends LibraryWrapper { public InteractionType getInteractionType(Class clazz) { if (ApplicationCommandInteraction.class.isAssignableFrom(clazz)) return InteractionType.COMMAND; + if (ButtonInteraction.class.isAssignableFrom(clazz)) + return InteractionType.BUTTON; return null; } @@ -168,15 +171,13 @@ public class JavacordWrapper extends LibraryWrapper { public Object getComponentContextObject(Object context, Class type) { ButtonInteraction button = (ButtonInteraction) context; switch (type.getName()) { - case "TextChannel": + case "org.javacord.api.entity.channel.TextChannel": return button.getChannel().orElse(null); - case "Message": + case "org.javacord.api.entity.message.Message": return button.getMessage(); - case "Server": + case "org.javacord.api.entity.server.Server": return button.getServer().orElse(null); - case "User": - return button.getUser(); - case "Member": + case "org.javacord.api.entity.user.User": return button.getUser(); } return null;