99import net .dv8tion .jda .api .events .message .MessageUpdateEvent ;
1010import net .dv8tion .jda .api .hooks .ListenerAdapter ;
1111import net .javadiscord .javabot .data .config .BotConfig ;
12- import net .javadiscord .javabot .data .h2db .DbHelper ;
1312import net .javadiscord .javabot .systems .moderation .warn .dao .WarnRepository ;
1413import net .javadiscord .javabot .systems .moderation .warn .model .WarnSeverity ;
1514import net .javadiscord .javabot .systems .notification .NotificationService ;
3837// TODO: Refactor this to be more efficient. Especially AutoMod#checkNewMessageAutomod
3938public class AutoMod extends ListenerAdapter {
4039
41- private static final Pattern INVITE_URL = Pattern .compile ("discord(?:(\\ .(?:me|io|gg)|sites\\ .com)/.{0,4}|app\\ .com.{1,4}(?:invite|oauth2).{0,5}/)\\ w+" );
40+ private static final Pattern INVITE_URL = Pattern .compile ("discord(?:(\\ .(?:me|io|gg)|sites\\ .com)/.{0,4}|(?: app)? \\ .com.{1,4}(?:invite|oauth2).{0,5}/)\\ w+" );
4241 private static final Pattern URL_PATTERN = Pattern .compile (
4342 "(?:^|[\\ W])((ht|f)tp(s?)://|www\\ .)"
4443 + "(([\\ w\\ -]+\\ .)+?([\\ w\\ -.~]+/?)*"
@@ -47,22 +46,19 @@ public class AutoMod extends ListenerAdapter {
4746 private final NotificationService notificationService ;
4847 private final BotConfig botConfig ;
4948 private List <String > spamUrls ;
50- private final DbHelper dbHelper ;
5149 private final WarnRepository warnRepository ;
5250 private final ExecutorService asyncPool ;
5351
5452 /**
5553 * Constructor of the class, that creates a list of strings with potential spam/scam urls.
5654 * @param notificationService The {@link QOTWPointsService}
5755 * @param botConfig The main configuration of the bot
58- * @param dbHelper An object managing databse operations
5956 * @param asyncPool The main thread pool for asynchronous operations
6057 * @param warnRepository The main thread pool for asynchronous operations
6158 */
62- public AutoMod (NotificationService notificationService , BotConfig botConfig , DbHelper dbHelper , ExecutorService asyncPool , WarnRepository warnRepository ) {
59+ public AutoMod (NotificationService notificationService , BotConfig botConfig , ExecutorService asyncPool , WarnRepository warnRepository ) {
6360 this .notificationService = notificationService ;
6461 this .botConfig = botConfig ;
65- this .dbHelper = dbHelper ;
6662 this .warnRepository = warnRepository ;
6763 this .asyncPool = asyncPool ;
6864 try (Scanner scan = new Scanner (new URL ("https://raw.githubusercontent.com/DevSpen/scam-links/master/src/links.txt" ).openStream ()).useDelimiter ("\\ A" )) {
0 commit comments