NoSwear

By Get_A_Fix on Feb 13, 2009

I checked the snippets and only found mIRC platform swear kickers.

This is a simple swear checker that can be adjusted to each channel via dcc (partyline) or a public/msg command.

Protects all users added to bot userfile, all channel @/Ops and +/Voices.

Default trigger set to "!"

SYNTAX:

PUBLIC: !noswear on
PUBLIC: !noswear off

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

NOTE: Available to Global OP (o) and above, Channel Master (m) and above.

# NoSwear Module

# Set global trigger here
set trigger "!"

# Set your swearword pattern below
set swearwords {
  "*fuck*"
  "*cunt*"
  "*shit*"
}

# -----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} {
  if {![matchattr $hand o|m $chan]} {return}
  if {([lindex [split $text] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]noswear on/off"; return}
  if {([lindex [split $text] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]noswear on/off"; return}

  if {[lindex [split $text] 0] == "on"} {
    if {[channel get $chan noswear] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
    if {[channel get $chan noswear] && [regexp c [getchanmode $chan]]} {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] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
    if {![channel get $chan noswear] && [regexp c [getchanmode $chan]]} {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
  set chan [strlwr [lindex $arg 0]]
  if {![matchattr $hand o|m $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 text} {
  global swearwords
  if {[channel get $chan noswear]} {
    foreach pattern $swearwords {
      if {[string match -nocase $pattern $text]} {
        if {![validuser $hand] && ![isop $nick $chan] && ![isvoice $nick $chan]} {
          putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]"
          putquick "KICK $chan $nick :\002\037S\037\002wear-\002\037W\037\002ord \002\037D\037\002etected. Please cease use of profanity while in $chan - Thank you."
        }
      }
    }
  }
}

proc noswear:act {nick uhost hand dest key text} {
  global swearwords
  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] && ![isvoice $nick $chan]} {
            putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]" 
            putquick "KICK $chan $nick :\002\037S\037\002wear-\002\037W\037\002ord \002\037D\037\002etected. Please cease use of profanity while in $chan - Thank you."
          }
        }
      }
    }
  }
}

putlog "Loaded: NoSwear Module."

Comments

Sign in to comment.
Adorer   -  Mar 04, 2012

xyzzy is right i agree..
but to some extend i believe these abuser should be banned from my channels instantly :>
and i found this script as according to my need
thanks this script rocks :> and no bugs in it :>>

 Respond  
Get_A_Fix   -  Aug 12, 2010

those can be easily added. I didn't make it like that though.

 Respond  
xyzzy   -  Aug 12, 2010

would be usefull if had options to warn/kick/ban ?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.