@@ -32,7 +32,8 @@ public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
3232 if (event .isWebhookMessage ()) {
3333 return ;
3434 }
35- if (event .getChannel ().getIdLong () == Bot .config .get (event .getGuild ()).getModeration ().getSuggestionChannelId ()) {
35+ if (event .getChannel ().getIdLong () == Bot .config .get (event .getGuild ()).getModeration ()
36+ .getSuggestionChannelId ()) {
3637 return ;
3738 }
3839 TextChannel tc = null ;
@@ -58,8 +59,14 @@ public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
5859 int indexBkp = index ;
5960 while ((index = lowerCaseContent .indexOf ("fuck" , index )) != -1 ) {
6061 sb .append (content .substring (indexBkp , index ));
61- sb .append ("hug" );
62+ sb .append (loadHug ( content , index ) );
6263 indexBkp = index ++ + 4 ;
64+ if (content .length () >= indexBkp + 3 && "ing" .equals (lowerCaseContent .substring (indexBkp , indexBkp + 3 ))) {
65+ sb .append (copyCase (content , indexBkp -1 , 'g' ));
66+ sb .append (content .substring (indexBkp , indexBkp + 3 ));
67+ index +=3 ;
68+ indexBkp +=3 ;
69+ }
6370 }
6471
6572 sb .append (content .substring (indexBkp , content .length ()));
@@ -69,6 +76,20 @@ public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
6976 }
7077 }
7178
79+ private String loadHug (String originalText , int startIndex ) {
80+ return copyCase (originalText , startIndex , 'h' ) + ""
81+ + copyCase (originalText , startIndex + 1 , 'u' ) + ""
82+ + copyCase (originalText , startIndex + 3 , 'g' );
83+ }
84+
85+ private char copyCase (String original , int index , char newChar ) {
86+ if (Character .isUpperCase (original .charAt (index ))) {
87+ return Character .toUpperCase (newChar );
88+ } else {
89+ return newChar ;
90+ }
91+ }
92+
7293 private void sendWebhookMessage (Webhook webhook , Message originalMessage , String newMessageContent , long threadId ) {
7394 WebhookUtil .mirrorMessageToWebhook (webhook , originalMessage , newMessageContent , threadId )
7495 .thenAccept (unused -> originalMessage .delete ().queue ()).exceptionally (e -> {
0 commit comments