diff --git a/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java b/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java index e01a879e82..12ee788fa1 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java @@ -104,7 +104,7 @@ private RestAction createAIResponse(ThreadChannel threadChannel, Messag } private static boolean isContextSufficient(Message message) { - return !MessageUtils.containsImage(message) + return !MessageUtils.containsAttachments(message) && !LinkDetection.containsLink(message.getContentRaw()); } diff --git a/application/src/main/java/org/togetherjava/tjbot/features/utils/MessageUtils.java b/application/src/main/java/org/togetherjava/tjbot/features/utils/MessageUtils.java index cb04c9e634..615e379a3c 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/utils/MessageUtils.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/utils/MessageUtils.java @@ -221,16 +221,16 @@ public static Optional extractCode(String fullMessage) { } /** - * Checks if a given message contains any image attachments. - * + * Checks if a given message contains any attachments. + * * @param message the message to be checked - * @return {@code true} if the message contains at least one image attachment + * @return {@code true} if the message contains at least one attachment * * @see Message * @see Message.Attachment */ - public static boolean containsImage(Message message) { - return message.getAttachments().stream().anyMatch(Message.Attachment::isImage); + public static boolean containsAttachments(Message message) { + return !message.getAttachments().isEmpty(); } }