Jump to content
chain

No Swear

Recommended Posts

  • Administrators

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."
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...