add correct null handling for api objects
This commit is contained in:
parent
5d8f737481
commit
92704ca230
@ -57,6 +57,8 @@ public class Discord4JWrapper extends LibraryWrapper {
|
||||
if (api != null)
|
||||
api.on(InteractionCreateEvent.class)
|
||||
.subscribe(event -> handleInteraction(event));
|
||||
else
|
||||
logger.warn("GatewayDiscordClient was null so no Events were subscribed to.");
|
||||
|
||||
logger.info("Discord4J wrapper loaded!");
|
||||
}
|
||||
|
@ -44,7 +44,10 @@ public class JavacordWrapper extends LibraryWrapper {
|
||||
public JavacordWrapper(DiscordApi api) {
|
||||
this.api = api;
|
||||
this.contextObjectProvider = new JavacordContextObjectProvider();
|
||||
api.addInteractionCreateListener((e) -> handleInteraction(e.getInteraction()));
|
||||
if (api != null)
|
||||
api.addInteractionCreateListener((e) -> handleInteraction(e.getInteraction()));
|
||||
else
|
||||
logger.warn("DiscordApi was null so no Events were subscribed to.");
|
||||
logger.info("Javacord wrapper loaded!");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user