add remaining logging in Javacord wrapper and exceptions
This commit is contained in:
parent
404f221ccf
commit
74d55d81ca
@ -73,7 +73,7 @@ public abstract class InteractionMethod {
|
|||||||
try {
|
try {
|
||||||
method.invoke(handler, getParameters(context));
|
method.invoke(handler, getParameters(context));
|
||||||
}catch (IllegalAccessException | InvocationTargetException ex) {
|
}catch (IllegalAccessException | InvocationTargetException ex) {
|
||||||
throw new RuntimeException(ex);
|
logger.fatal(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.appliedChecks.forEach(x -> x.post(context));
|
this.appliedChecks.forEach(x -> x.post(context));
|
||||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.javacord.api.DiscordApi;
|
import org.javacord.api.DiscordApi;
|
||||||
import org.javacord.api.interaction.ApplicationCommandInteraction;
|
import org.javacord.api.interaction.ApplicationCommandInteraction;
|
||||||
import org.javacord.api.interaction.ButtonInteraction;
|
import org.javacord.api.interaction.ButtonInteraction;
|
||||||
@ -25,15 +26,19 @@ import net.tomatentum.marinara.interaction.commands.annotation.SlashCommandOptio
|
|||||||
import net.tomatentum.marinara.interaction.commands.annotation.SubCommand;
|
import net.tomatentum.marinara.interaction.commands.annotation.SubCommand;
|
||||||
import net.tomatentum.marinara.interaction.commands.annotation.SubCommandGroup;
|
import net.tomatentum.marinara.interaction.commands.annotation.SubCommandGroup;
|
||||||
import net.tomatentum.marinara.interaction.commands.option.SlashCommandOptionType;
|
import net.tomatentum.marinara.interaction.commands.option.SlashCommandOptionType;
|
||||||
|
import net.tomatentum.marinara.util.LoggerUtil;
|
||||||
import net.tomatentum.marinara.wrapper.LibraryWrapper;
|
import net.tomatentum.marinara.wrapper.LibraryWrapper;
|
||||||
|
|
||||||
public class JavacordWrapper extends LibraryWrapper {
|
public class JavacordWrapper extends LibraryWrapper {
|
||||||
|
|
||||||
private DiscordApi api;
|
private DiscordApi api;
|
||||||
|
|
||||||
|
private Logger logger = LoggerUtil.getLogger(getClass());
|
||||||
|
|
||||||
public JavacordWrapper(DiscordApi api) {
|
public JavacordWrapper(DiscordApi api) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
api.addInteractionCreateListener((e) -> handleInteraction(e.getInteraction()));
|
api.addInteractionCreateListener((e) -> handleInteraction(e.getInteraction()));
|
||||||
|
logger.info("Javacord wrapper loaded!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -99,7 +104,7 @@ public class JavacordWrapper extends LibraryWrapper {
|
|||||||
}else
|
}else
|
||||||
builder.setSubCommand(TypeFactory.annotation(SubCommand.class, Map.of("name", options.getFirst().getName())));
|
builder.setSubCommand(TypeFactory.annotation(SubCommand.class, Map.of("name", options.getFirst().getName())));
|
||||||
} catch (AnnotationFormatException e) {
|
} catch (AnnotationFormatException e) {
|
||||||
e.printStackTrace();
|
logger.fatal(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user