@@ -53,11 +53,6 @@ public void onMessageReceived(MessageReceivedEvent event) {
5353 }
5454 }
5555
56- // private boolean messageHasNoMediaAttached(Message message) {
57- // return message.getAttachments().isEmpty() && message.getEmbeds().isEmpty()
58- // && !message.getContentRaw().contains("http");
59- // }
60-
6156 /**
6257 * Checks whether the given message has no media attached.
6358 * <p>
@@ -72,13 +67,9 @@ private boolean messageHasNoMediaAttached(Message message) {
7267 if (hasMedia (message .getAttachments (), message .getEmbeds (), message .getContentRaw ())) {
7368 return false ;
7469 }
75- // checks forwarded snapshots
76- for (MessageSnapshot snapshot : message .getMessageSnapshots ()) {
77- if (hasMedia (snapshot .getAttachments (), snapshot .getEmbeds (), snapshot .getContentRaw ())) {
78- return false ;
79- }
80- }
81- return true ;
70+
71+ return message .getMessageSnapshots ().stream ().noneMatch (snapshot ->
72+ hasMedia (snapshot .getAttachments (), snapshot .getEmbeds (), snapshot .getContentRaw ()));
8273 }
8374 /**
8475 * Checks whether the given content contains any media.
@@ -90,7 +81,6 @@ private boolean messageHasNoMediaAttached(Message message) {
9081 * @param embeds the embeds of the message or snapshot
9182 * @param content the raw text content of the message or snapshot
9283 */
93-
9484 private boolean hasMedia (List <Message .Attachment > attachments ,
9585 List <MessageEmbed > embeds , String content ) {
9686 return !attachments .isEmpty ()
0 commit comments