From eaf0372d42b6187c79356f6d4d619550b1bc6981 Mon Sep 17 00:00:00 2001 From: twonirwana Date: Sat, 7 Sep 2024 10:02:57 +0200 Subject: [PATCH] no warning in direct rolls (#562) --- .../bot/command/directRoll/DirectRollCommand.java | 11 ++--------- .../command/directRoll/DirectRollCommandMockTest.snap | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/bot/src/main/java/de/janno/discord/bot/command/directRoll/DirectRollCommand.java b/bot/src/main/java/de/janno/discord/bot/command/directRoll/DirectRollCommand.java index da5e2b32..486f2364 100644 --- a/bot/src/main/java/de/janno/discord/bot/command/directRoll/DirectRollCommand.java +++ b/bot/src/main/java/de/janno/discord/bot/command/directRoll/DirectRollCommand.java @@ -3,7 +3,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.base.Stopwatch; -import com.google.common.base.Strings; import de.janno.discord.bot.AnswerInteractionType; import de.janno.discord.bot.BotMetrics; import de.janno.discord.bot.I18n; @@ -34,8 +33,6 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static de.janno.discord.bot.command.channelConfig.ChannelConfigCommand.DIRECT_ROLL_CONFIG_TYPE_ID; @@ -155,13 +152,9 @@ protected EmbedOrMessageDefinition getHelpMessage(Locale userLocale) { @NonNull RollAnswer answer, @NonNull Stopwatch stopwatch, @NonNull Locale userLocale) { - String warningMessage = Stream.of(commandString, answer.getWarning()) - .filter(s -> !Strings.isNullOrEmpty(s)) - .collect(Collectors.joining(" ")); - Mono answerMono = Strings.isNullOrEmpty(answer.getWarning()) ? - Mono.defer(() -> event.replyWithEmbedOrMessageDefinition(RollAnswerConverter.toEmbedOrMessageDefinition(answer), false)) : - Mono.defer(() -> event.reply(warningMessage, true)); + //ignore warning, no good way to display it + Mono answerMono = Mono.defer(() -> event.replyWithEmbedOrMessageDefinition(RollAnswerConverter.toEmbedOrMessageDefinition(answer), false)); return answerMono .doOnSuccess(v -> log.info("{}: '{}'={} -> {} in {}ms", diff --git a/bot/src/test/java/de/janno/discord/bot/command/directRoll/DirectRollCommandMockTest.snap b/bot/src/test/java/de/janno/discord/bot/command/directRoll/DirectRollCommandMockTest.snap index 4b830af7..2ae34799 100644 --- a/bot/src/test/java/de/janno/discord/bot/command/directRoll/DirectRollCommandMockTest.snap +++ b/bot/src/test/java/de/janno/discord/bot/command/directRoll/DirectRollCommandMockTest.snap @@ -119,7 +119,7 @@ de.janno.discord.bot.command.directRoll.DirectRollCommandMockTest.roll_multiLine de.janno.discord.bot.command.directRoll.DirectRollCommandMockTest.roll_warn=[ [ - "reply: commandString did not contain any random element, try for Example `d20` to roll a 20 sided die" + "replyWithEmbedOrMessageDefinition: EmbedOrMessageDefinition(title=20 ⇒ 20, descriptionOrContent=, fields=[], componentRowDefinitions=[], hasImage=false, type=EMBED, userReference=true, sendToOtherChannelId=null)" ] ]