55import net .discordjug .javabot .systems .moderation .warn .model .WarnSeverity ;
66import net .discordjug .javabot .systems .notification .NotificationService ;
77import net .discordjug .javabot .util .ExceptionLogger ;
8+ import net .discordjug .javabot .util .MessageUtils ;
89import net .dv8tion .jda .api .Permission ;
910import net .dv8tion .jda .api .entities .Member ;
1011import net .dv8tion .jda .api .entities .Message ;
@@ -132,7 +133,7 @@ private void checkContentAutomod(@Nonnull Message message) {
132133 }
133134
134135 private void doAutomodActions (Message message , String reason ) {
135- notificationService .withGuild (message .getGuild ()).sendToModerationLog (c -> c .sendMessageFormat ("Message by %s: `%s`" , message .getAuthor ().getAsMention (), message . getContentRaw ( )));
136+ notificationService .withGuild (message .getGuild ()).sendToModerationLog (c -> c .sendMessageFormat ("Message by %s: `%s`" , message .getAuthor ().getAsMention (), MessageUtils . getMessageContent ( message )));
136137 moderationService
137138 .warn (
138139 message .getAuthor (),
@@ -188,7 +189,7 @@ private void handleSpam(@Nonnull Message msg, Member member) {
188189 * @return True if a link is found and False if not.
189190 */
190191 public boolean hasSuspiciousLink (@ NotNull Message message ) {
191- final String messageRaw = message . getContentRaw ( );
192+ final String messageRaw = MessageUtils . getMessageContent ( message );
192193 Matcher urlMatcher = URL_PATTERN .matcher (messageRaw );
193194 if (messageRaw .contains ("http://" ) || messageRaw .contains ("https://" )) {
194195 // only do it for a links, so it won't iterate for each message
@@ -217,7 +218,7 @@ public boolean hasSuspiciousLink(@NotNull Message message) {
217218 */
218219 public boolean hasAdvertisingLink (@ NotNull Message message ) {
219220 // Advertising
220- Matcher matcher = INVITE_URL .matcher (cleanString (message . getContentRaw ( )));
221+ Matcher matcher = INVITE_URL .matcher (cleanString (MessageUtils . getMessageContent ( message )));
221222 int start = 0 ;
222223 while (matcher .find (start )) {
223224 if (botConfig .get (message .getGuild ()).getModerationConfig ().getAutomodInviteExcludes ().stream ().noneMatch (matcher .group ()::contains )) {
@@ -232,4 +233,5 @@ private boolean isSuggestionsChannel(@NotNull MessageChannelUnion channel) {
232233 return channel .getType ().isGuild () &&
233234 channel .getIdLong () == botConfig .get (channel .asGuildMessageChannel ().getGuild ()).getModerationConfig ().getSuggestionChannel ().getIdLong ();
234235 }
236+
235237}
0 commit comments