Advertisement
Guest User

dotop123456

a guest
Mar 2nd, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. private void bannedWordsFilter(String sentMessage2) {
  2.         //only moderate if the bot is modded on the channel and the sender is not a mod! this is important
  3.        
  4.         ModElement e1= new ModElement(nick, targetChannel);
  5.         ModElement e2= new ModElement(sender, targetChannel);
  6.        
  7.         boolean allow1=false;
  8.         boolean deny2=false;
  9.        
  10.         if(lists.getModlist().contains(e1)) allow1=true;
  11.         if(lists.getModlist().contains(e2)) deny2=true;
  12.        
  13.         if(allow1&&!deny2){
  14.             //modding method
  15.             for(BannedWordElement e : lists.getBannedWords()){
  16.                 Pattern p=Pattern.compile(e.word.toLowerCase());
  17.                 Matcher m=p.matcher(sentMessage2.toLowerCase());
  18.                 if(m.find() &&(e.channel.contentEquals("all")||e.channel.contentEquals(targetChannel))){
  19.                     if(e.level==BannedWordElement.BAN) sendBAN(targetChannel, sender);
  20.                     else sendTO(targetChannel, sender, e.level);
  21.                 }
  22.             }
  23.         }
  24.        
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement