Skip to content

Commit 6e21cf9

Browse files
committed
fix: apply code formatting
1 parent 2725aa1 commit 6e21cf9

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

application/src/main/java/org/togetherjava/tjbot/features/mediaonly/MediaOnlyChannelListener.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ public void onMessageReceived(MessageReceivedEvent event) {
5555
/**
5656
* Checks whether the given message has no media attached.
5757
* <p>
58-
* A message is considered to have media if it contains attachments, embeds,
59-
* or a URL in its text content. For forwarded messages, the snapshots are also
60-
* checked for media.
58+
* A message is considered to have media if it contains attachments, embeds, or a URL in its
59+
* text content. For forwarded messages, the snapshots are also checked for media.
6160
*
6261
* @param message the message to check
6362
* @return {@code true} if the message has no media, {@code false} otherwise
@@ -67,24 +66,25 @@ private boolean messageHasNoMediaAttached(Message message) {
6766
return false;
6867
}
6968

70-
return message.getMessageSnapshots().stream().noneMatch(snapshot ->
71-
hasMedia(snapshot.getAttachments(), snapshot.getEmbeds(), snapshot.getContentRaw()));
69+
return message.getMessageSnapshots()
70+
.stream()
71+
.noneMatch(snapshot -> hasMedia(snapshot.getAttachments(), snapshot.getEmbeds(),
72+
snapshot.getContentRaw()));
7273
}
74+
7375
/**
7476
* Checks whether the given content contains any media.
7577
* <p>
76-
* Media is considered present if there are attachments, embeds,
77-
* or a URL (identified by {@code "http"}) in the text content.
78+
* Media is considered present if there are attachments, embeds, or a URL (identified by
79+
* {@code "http"}) in the text content.
7880
*
7981
* @param attachments the attachments of the message or snapshot
8082
* @param embeds the embeds of the message or snapshot
8183
* @param content the raw text content of the message or snapshot
8284
*/
83-
private boolean hasMedia(List<Message.Attachment> attachments,
84-
List<MessageEmbed> embeds, String content) {
85-
return !attachments.isEmpty()
86-
|| !embeds.isEmpty()
87-
|| content.contains("http");
85+
private boolean hasMedia(List<Message.Attachment> attachments, List<MessageEmbed> embeds,
86+
String content) {
87+
return !attachments.isEmpty() || !embeds.isEmpty() || content.contains("http");
8888
}
8989

9090
private MessageCreateData createNotificationMessage(Message message) {

application/src/test/java/org/togetherjava/tjbot/features/mediaonly/MediaOnlyChannelListenerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void deletesForwardedMessageWithoutMedia() {
150150
}
151151

152152
private MessageReceivedEvent sendMessageWithSnapshots(MessageCreateData message,
153-
List<MessageSnapshot> snapshots) {
153+
List<MessageSnapshot> snapshots) {
154154
MessageReceivedEvent event =
155155
jdaTester.createMessageReceiveEvent(message, List.of(), ChannelType.TEXT);
156156
when(event.getMessage().getMessageSnapshots()).thenReturn(snapshots);

0 commit comments

Comments
 (0)