add correct null handling for api objects
This commit is contained in:
@@ -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!");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user