Skip to content

Commit 85b2dd8

Browse files
Removed ExceptionLogger from AutoMod
1 parent 5e85677 commit 85b2dd8

File tree

1 file changed

+3
-5
lines changed
  • src/main/java/net/javadiscord/javabot/systems/moderation

1 file changed

+3
-5
lines changed

src/main/java/net/javadiscord/javabot/systems/moderation/AutoMod.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import java.net.URL;
2222
import java.time.Duration;
2323
import java.time.temporal.ChronoUnit;
24-
import java.util.Arrays;
2524
import java.util.List;
25+
import java.util.Objects;
2626
import java.util.Scanner;
2727
import java.util.regex.Matcher;
2828
import java.util.regex.Pattern;
@@ -164,7 +164,7 @@ private void checkContentAutomod(@Nonnull Message message) {
164164
*/
165165
private void handleSpam(@Nonnull Message msg, Member member) {
166166
// java files -> not spam
167-
if (!msg.getAttachments().isEmpty() && msg.getAttachments().stream().allMatch(a -> a.getFileExtension().equals("java"))) {
167+
if (!msg.getAttachments().isEmpty() && msg.getAttachments().stream().allMatch(a -> Objects.equals(a.getFileExtension(), "java"))) {
168168
return;
169169
}
170170
new ModerationService(Bot.config.get(member.getGuild()))
@@ -196,21 +196,19 @@ private void handleSpam(@Nonnull Message msg, Member member) {
196196
* @param message The message to check.
197197
* @return True if a link is found and False if not.
198198
*/
199-
public boolean hasSuspiciousLink(Message message) {
199+
public boolean hasSuspiciousLink(@NotNull Message message) {
200200
final String messageRaw = message.getContentRaw();
201201
Matcher urlMatcher = URL_PATTERN.matcher(messageRaw);
202202
if (messageRaw.contains("http://") || messageRaw.contains("https://")) {
203203
// only do it for a links, so it won't iterate for each message
204204
while (urlMatcher.find()) {
205205
String url = urlMatcher.group(0).trim();
206206
try {
207-
// TODO: Fix URISyntaxException
208207
URI uri = new URI(url);
209208
if (uri.getHost() != null && spamUrls.contains(uri.getHost())) {
210209
return true;
211210
}
212211
} catch (URISyntaxException e) {
213-
ExceptionLogger.capture(e, getClass().getSimpleName());
214212
log.error("Error while parsing URL: " + url, e);
215213
}
216214
}

0 commit comments

Comments
 (0)