Skip to content

Commit

Permalink
Fix ChatInputCommandGrammar#resolve never completing with records
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex1304 committed May 11, 2024
1 parent 8aa286c commit 65fc707
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,13 @@ private Mono<T> resolveRecordClass(ChatInputInteractionEvent event) {
publishers.add(Mono.justOrEmpty(getOptionByName(event, optionAnnot.name()))
.flatMap(option -> Mono.justOrEmpty(option.getValue())
.flatMap(value -> extractOptionValue(option.getType(), value,
event.getInteraction().getGuildId().orElse(null)))));
event.getInteraction().getGuildId().orElse(null)))
.map(Optional::of))
.switchIfEmpty(Mono.just(Optional.empty())));
}
return Mono.zip(publishers,
params -> (T) ConfigUtils.instantiateRecord(valueClass.asSubclass(Record.class), params));
params -> (T) ConfigUtils.instantiateRecord(valueClass.asSubclass(Record.class),
Arrays.stream(params).map(opt -> ((Optional<?>) opt).orElse(null)).toArray()));
});
}

Expand Down

0 comments on commit 65fc707

Please sign in to comment.