Skip to content

Commit

Permalink
fix: later addEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
qixils committed Dec 21, 2023
1 parent 4624aa0 commit 977a32a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/dev/qixils/quasicord/Quasicord.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ protected Quasicord(@NonNull String namespace, @NonNull List<Locale> locales, @N
// late initialize (depends on JDA)
rootRegistry = new RegistryRegistry(this);
this.commandManager = new CommandManager(this);
jda.addEventListener(commandManager);
registerCommands();
commandManager.upsertCommands(jda);
}
Expand Down Expand Up @@ -136,7 +137,6 @@ protected JDA initJDA(@Nullable Activity activity) {
JDA jda = builder.build();
jda.setRequiredScopes("applications.commands");
jda.addEventListener(tempListenerExecutor);
jda.addEventListener(commandManager);
jda.addEventListener(new Object() {
@net.dv8tion.jda.api.hooks.SubscribeEvent
public void on(net.dv8tion.jda.api.events.Event event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ public void loadTranslations() throws IOException {
logger.warn("Failed to load translations for locale {} in namespace {}: file not found", locale, namespace);
continue;
}

Map<String, Object> translationMap = yaml.load(inputStream);
if (translationMap == null) {
logger.warn("Failed to load translations for locale {} in namespace {}: yaml returned null", locale, namespace);
continue;
}

// some language files are nested inside the language code, so we need to extract
// the inner map
Expand Down

0 comments on commit 977a32a

Please sign in to comment.