Skip to content

Commit 1247bfd

Browse files
author
burdo
committed
do not show tokens in presentation
1 parent 644fbb3 commit 1247bfd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/org/comroid/api/config/ConfigurationManager.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import net.dv8tion.jda.api.hooks.ListenerAdapter;
2727
import net.dv8tion.jda.api.interactions.InteractionHook;
2828
import net.dv8tion.jda.api.modals.Modal;
29+
import net.dv8tion.jda.api.requests.RestAction;
2930
import org.comroid.annotations.Ignore;
3031
import org.comroid.annotations.internal.Annotations;
3132
import org.comroid.api.attr.Aliased;
@@ -242,7 +243,8 @@ protected boolean checkOutOfContext(GenericInteractionCreateEvent event) {
242243
public void clear() {
243244
List<Message> ls = List.of();
244245
do {
245-
if (!ls.isEmpty()) channel.deleteMessages(ls).complete();
246+
if (ls.size() >= 2) channel.deleteMessages(ls).complete();
247+
else ls.stream().map(Message::delete).forEach(RestAction::queue);
246248
ls = channel.getHistory().retrievePast(100).complete();
247249
} while (!ls.isEmpty());
248250
}
@@ -358,9 +360,10 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) {
358360
event.deferReply().submit().thenCompose(hook -> {
359361
if (checkOutOfContext(event)) return CompletableFuture.completedFuture(null);
360362
event.replyModal(Modal.create(event.getComponentId(), event.getComponentId())
361-
.addComponents(Label.of("New Value", TextInput.create("newValue", TextInputStyle.SHORT)
362-
.setPlaceholder(config.get(event.getComponentId().split("\\.")).asString())
363-
.build()))
363+
.addComponents(Label.of("New Value",
364+
TextInput.create("newValue", TextInputStyle.SHORT)
365+
.setPlaceholder(config.get(event.getComponentId().split("\\.")).asString())
366+
.build()))
364367
.build()).queue();
365368
return hook.sendMessage("Done!").setEphemeral(false).submit();
366369
}).exceptionally(Debug.exceptionLogger("Internal error when handling interaction"));

0 commit comments

Comments
 (0)