fix class names and add Button Interaction type case
This commit is contained in:
parent
480c1ec81f
commit
8a7348eebc
@ -14,6 +14,7 @@ import org.javacord.api.interaction.ButtonInteraction;
|
|||||||
import org.javacord.api.interaction.SlashCommandBuilder;
|
import org.javacord.api.interaction.SlashCommandBuilder;
|
||||||
import org.javacord.api.interaction.SlashCommandInteraction;
|
import org.javacord.api.interaction.SlashCommandInteraction;
|
||||||
import org.javacord.api.interaction.SlashCommandInteractionOption;
|
import org.javacord.api.interaction.SlashCommandInteractionOption;
|
||||||
|
import org.javacord.core.entity.user.Member;
|
||||||
|
|
||||||
import io.leangen.geantyref.AnnotationFormatException;
|
import io.leangen.geantyref.AnnotationFormatException;
|
||||||
import io.leangen.geantyref.TypeFactory;
|
import io.leangen.geantyref.TypeFactory;
|
||||||
@ -40,6 +41,8 @@ public class JavacordWrapper extends LibraryWrapper {
|
|||||||
public InteractionType getInteractionType(Class<?> clazz) {
|
public InteractionType getInteractionType(Class<?> clazz) {
|
||||||
if (ApplicationCommandInteraction.class.isAssignableFrom(clazz))
|
if (ApplicationCommandInteraction.class.isAssignableFrom(clazz))
|
||||||
return InteractionType.COMMAND;
|
return InteractionType.COMMAND;
|
||||||
|
if (ButtonInteraction.class.isAssignableFrom(clazz))
|
||||||
|
return InteractionType.BUTTON;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -168,15 +171,13 @@ public class JavacordWrapper extends LibraryWrapper {
|
|||||||
public Object getComponentContextObject(Object context, Class<?> type) {
|
public Object getComponentContextObject(Object context, Class<?> type) {
|
||||||
ButtonInteraction button = (ButtonInteraction) context;
|
ButtonInteraction button = (ButtonInteraction) context;
|
||||||
switch (type.getName()) {
|
switch (type.getName()) {
|
||||||
case "TextChannel":
|
case "org.javacord.api.entity.channel.TextChannel":
|
||||||
return button.getChannel().orElse(null);
|
return button.getChannel().orElse(null);
|
||||||
case "Message":
|
case "org.javacord.api.entity.message.Message":
|
||||||
return button.getMessage();
|
return button.getMessage();
|
||||||
case "Server":
|
case "org.javacord.api.entity.server.Server":
|
||||||
return button.getServer().orElse(null);
|
return button.getServer().orElse(null);
|
||||||
case "User":
|
case "org.javacord.api.entity.user.User":
|
||||||
return button.getUser();
|
|
||||||
case "Member":
|
|
||||||
return button.getUser();
|
return button.getUser();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user