egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

My badword script stop working if I put many words

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Moti
Voice


Joined: 20 Sep 2013
Posts: 15

PostPosted: Mon Jan 06, 2014 4:40 pm    Post subject: My badword script stop working if I put many words Reply with quote

Hi,

I found a badwords script at google.
It's work perfect, but if I put many words its stop to work.

Somebody know what can I do to use this script with list of 800 words?

This is my script:
Code:
# Default trigger set to "!"

# SYNTAX:
# -------

# PUBLIC: !noswear on
# PUBLIC: !noswear off

# MSG: /msg yourbot noswear #channelname on
# MSG: /msg yourbot noswear #channelname off

# NOTE: Currently set to Global OP (o) and above, Channel Master (m) and above.
# --------------------------------------------------------------------------

# Set global trigger here
set trigger "!"

# Set access flags for command here (example: o|m <- globalop|channelmaster)
set accessflags "o|m"

# Set how long to leave devoiced (set in minutes)
set devoicetime "1"

# Set your swearword pattern below
set swearwords {
"*anus*"
"*arse*"
"*arsehole*"
"*ass*"
"*asshat*"
}

# -----DONT EDIT BELOW-----
bind pub - ${trigger}noswear noswear:pub
bind msg - noswear noswear:msg
bind pubm - * noswear:text
bind ctcp - ACTION noswear:act

setudef flag noswear

proc getTrigger {} {
  global trigger
  return $trigger
}

proc noswear:pub {nick uhost hand chan text} {
  global accessflags
  if {![matchattr [nick2hand $nick] $accessflags $chan]} {return}
  if {[lindex [split $text] 0] == ""} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]noswear on/off"; return}
 
  if {[lindex [split $text] 0] == "on"} {
    if {[channel get $chan noswear]} {putquick "PRIVMSG $chan :ERROR: This setting is already enabled."; return}
    channel set $chan +noswear
    puthelp "PRIVMSG $chan :Enabled Swearing Protection for $chan"
  }
 
  if {[lindex [split $text] 0] == "off"} {
    if {![channel get $chan noswear]} {putquick "PRIVMSG $chan :ERROR: This setting is already disabled."; return}
    channel set $chan -noswear
    puthelp "PRIVMSG $chan :Disabled Swearing Protection for $chan"
  }
}
 
proc noswear:msg {nick uhost hand arg} {
  global botnick accessflags
  set chan [strlwr [lindex $arg 0]]
  if {![matchattr [nick2hand $nick] $accessflags $chan]} {return}
  if {![string match "*#*" $arg]} {return}
  if {[lindex [split $arg] 0] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick noswear #channel on/off"; return}
  if {[lindex [split $arg] 1] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick noswear $chan on/off"; return}
 
  if {[lindex [split $arg] 1] == "on"} {
    if {[channel get $chan noswear]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
    channel set $chan +noswear
    putquick "NOTICE $nick :Enabled Swearing Protection for $chan"
  }
 
  if {[lindex [split $arg] 1] == "off"} {
    if {![channel get $chan noswear]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
    channel set $chan -noswear
    putquick "NOTICE $nick :Disabled Swearing Protection for $chan"
  }
}
 
proc noswear:text {nick uhost hand chan arg} {
  global botnick swearwords devoicetime
  if {[channel get $chan noswear]} {
    foreach pattern $swearwords {
      if {[string match -nocase $pattern $arg]} {
        if {![validuser $hand] && ![isop $nick $chan]} {
          set mask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
          putquick "mode $chan -v $nick"
          putserv "privmsg $nick :\00307WARNING:\00300 Violation of Chat Rules: Abusive Language."
          putserv "privmsg $nick :\00303STATUS:\00300 Muted (60 seconds)."
          putserv "privmsg $nick :\00312MESSAGE:\00300 Dear $nick, you have been muted. This means for the next 60 seconds, you will not be able to send messages to the chat. In order to prevent this from happening again, please do not use abusive language in the chat."
          newignore $mask $botnick "Swear Devoice Ignore" 0
          timer $devoicetime [list putquick "mode $chan +v $nick"]
          timer $devoicetime [list killignore $mask]
          utimer 65 "putserv \"privmsg $nick :\00303STATUS:\00300\ In good standing.\""
          utimer 65 "putserv \"privmsg $nick :\00312MESSAGE:\00300 Good news $nick, your 60 second mute has expired and you are now able to send messages. Please remember to respect our chat rules!\""
        }
      }
    }
  }
}
 
proc noswear:act {nick uhost hand dest key text} {
  global botnick swearwords devoicetime
  if {![string match "*#*" $dest]} {return}
  set chan $dest
  if {[channel get $chan noswear]} {
    foreach pattern $swearwords {
      if {[string match -nocase $pattern $text]} {
        if {[botisop $chan] && ![isbotnick $nick]} {
          if {[onchan $nick $chan] && ![validuser $hand] && ![isop $nick $chan]} {
            set mask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
            putquick "mode $chan -v $nick"
            putserv "privmsg $nick :\00307WARNING:\00300 Violation of Chat Rules: Abusive Language."
            putserv "privmsg $nick :\00303STATUS:\00300 Muted (60 seconds)."
            putserv "privmsg $nick :\00312MESSAGE:\00300 Dear $nick, you have been muted. This means for the next 60 seconds, you will not be able to send messages to the chat. In order to prevent this from happening again, please do not use abusive language in the chat."
            newignore $mask $botnick "Swear Devoice Ignore" 0
            timer $devoicetime [list putquick "mode $chan +v $nick"]
            timer $devoicetime [list killignore $mask]
            utimer 65 "putserv \"privmsg $nick :\00303STATUS:\00300\ In good standing.\""
            utimer 65 "putserv \"privmsg $nick :\00312MESSAGE:\00300 Good news $nick, your 60 second mute has expired and you are now able to send messages. Please remember to respect our chat rules!\""
          }
        }
      }
    }
  }
}
 
putlog "Loaded: NoSwear Module."


Thank you !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber