This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

partquit.tcl

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Fahad
Op
Posts: 129
Joined: Mon Aug 29, 2016 9:40 am

partquit.tcl

Post by Fahad »

I Found old TCL ( partquit. ) it has 2 error please help to fix this if anyone know. Thanks

!joinpart on - Working FINE

!joinquit on - Tcl error [joinquit:pub]: unbalanced open paren

!quitcheck on - Same error
<MuteServ> [16:57:25] Tcl error [quitcheck:pub]: unbalanced open paren
<MuteServ> in expression "...c [getchanmode $chan]]"
<MuteServ> [16:58:19] Tcl error [joinquit:pub]: unbalanced open paren
<MuteServ> in expression "...c [getchanmode $chan]]"
<MuteServ> [17:00:00] Writing user file...
<MuteServ> [17:00:00] Writing channel file...
<MuteServ> [17:00:05] Tcl error [quitcheck:pub]: unbalanced open paren
<MuteServ> in expression "...c [getchanmode $chan]]"

Code: Select all

# $Id: partquit.tcl,v1.5.1 28/06/2016 6:14:12pm GMT +12 (NZST) IRCSpeed Exp $

# This script covers 3 factors.
# 1) quitcheck - monitors quits for abusive text, like autokills, excess floods, or spam
# 2) joinpart - monitors joins/parts to channel and will set ban if joins exceed parttime
# 3) joinquit - monitors joins/quits to channel and will set ban if quits exceed jointime

## SYNTAX:
# (these are available to Global OPs and Channel Master's and above)
# ---------
# !quitcheck on|off
# !joinpart on|off
# !joinquit on|off
# /msg yourbot quitcheck #channel on|off
# /msg yourbot joinpart #channel on|off
# /msg yourbot joinquit #channel on|off

# Set global trigger here
set trigger "!"

# Set time in sec for how long someone should have stayed joined, before they part.
set parttime "10"

# Set time in sec for how long someone should have stayed joined, before they quit.
set jointime "5"

# Set your quit match pattern below
set quitwords {
  "*excess flood*"
  "*k-line*"
  "*killed*"
  "*join #*"
  "*/server*"
}

# Set your exempt match pattern below
set exemptwords {
  "*dontbanme*"
  "*i live on IRCSpeed and all i got was this lousy k-line*"
}

# -----DONT EDIT BELOW-----
bind pub - ${trigger}quitcheck quitcheck:pub
bind pub - ${trigger}joinpart joinpart:pub
bind pub - ${trigger}joinquit joinquit:pub
bind msg - quitcheck quitcheck:msg
bind msg - joinpart joinpart:msg
bind msg - joinquit joinquit:msg
bind part - * join:part
bind sign - * join:quit
bind sign - * quit:check

setudef flag quitcheck
setudef flag joinpart
setudef flag joinquit

proc getTrigger {} {
  global trigger
  return $trigger
}

proc quitcheck:pub {nick uhost hand chan text} {
  global botnick
  if {![matchattr [nick2hand $nick] o|m $chan]} {return}
  if {([lindex [split $text] 0] == "") && (![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]quitcheck on/off"; return}
  if {([lindex [split $text] 0] == "") && ([regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]quitcheck on/off"; return}

  if {[lindex [split $text] 0] == "on"} {
    if {[channel get $chan quitcheck] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
    if {[channel get $chan quitcheck] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: This setting is already enabled."; return}
    channel set $chan +quitcheck
    puthelp "PRIVMSG $chan :Enabled QuitCheck Protection for $chan"
    return 0
  }

  if {[lindex [split $text] 0] == "off"} {
    if {![channel get $chan quitcheck] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
    if {![channel get $chan quitcheck] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: This setting is already disabled."; return}
    channel set $chan -quitcheck
    puthelp "PRIVMSG $chan :Disabled QuitCheck Protection for $chan"
    return 0
  }
}

proc joinquit:pub {nick uhost hand chan text} {
  global botnick
  if {![matchattr [nick2hand $nick] o|m $chan]} {return}
  if {([lindex [split $text] 0] == "") && (![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]joinquit on/off"; return}
  if {([lindex [split $text] 0] == "") && ([regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]joinquit on/off"; return}

  if {[lindex [split $text] 0] == "on"} {
    if {[channel get $chan joinquit] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
    if {[channel get $chan joinquit] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: This setting is already enabled."; return}
    channel set $chan +joinquit
    puthelp "PRIVMSG $chan :Enabled JoinQuit Protection for $chan"
    return 0
  }

  if {[lindex [split $text] 0] == "off"} {
    if {![channel get $chan joinquit] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
    if {![channel get $chan joinquit] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: This setting is already disabled."; return}
    channel set $chan -joinquit
    puthelp "PRIVMSG $chan :Disabled JoinQuit Protection for $chan"
    return 0
  }
}

proc joinpart:pub {nick uhost hand chan arg} {
  global botnick
  if {![matchattr [nick2hand $nick] o|m $chan]} {return}
  if {[lindex [split $arg] 0] == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]joinpart on|off"; return}

  if {[lindex [split $arg] 0] == "on"} {
    if {[channel get $chan joinpart]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
    channel set $chan +joinpart
    puthelp "PRIVMSG $chan :Enabled JoinPart Protection for $chan"
    return 0
  }

  if {[lindex [split $arg] 0] == "off"} {
    if {![channel get $chan joinpart]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
    channel set $chan -joinpart
    puthelp "PRIVMSG $chan :Disabled JoinPart Protection for $chan"
    return 0
  }
}

proc joinquit:msg {nick uhost hand arg} {
  global botnick
  set chan [strlwr [lindex $arg 0]]
  if {![matchattr [nick2hand $nick] o|m $chan]} {return}
  if {[lindex [split $arg] 0] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinquit #channel on/off"; return}
  if {([lindex [split $arg] 1] == "") && ([string match "*#*" $chan])} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinquit $chan on/off"; return}

  if {([lindex [split $arg] 1] == "on") && ([string match "*#*" $chan])} {
    if {[channel get $chan joinquit]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
    channel set $chan +joinquit
    putquick "NOTICE $nick :Enabled JoinQuit Protection for $chan"
  }

  if {([lindex [split $arg] 1] == "off") && ([string match "*#*" $chan])} {
    if {![channel get $chan joinquit]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
    channel set $chan -joinquit
    putquick "NOTICE $nick :Disabled JoinQuit Protection for $chan"
  }
}

proc joinpart:msg {nick uhost hand arg} {
  global botnick
  set chan [strlwr [lindex $arg 0]]
  if {![matchattr [nick2hand $nick] o|m $chan]} {return}
  if {[lindex [split $arg] 0] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinpart #channel on|off"; return}
  if {[lindex [split $arg] 1] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinpart $chan on|off"; return}

  if {[lindex [split $arg] 1] == "on"} {
    if {[channel get $chan joinpart]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
    channel set $chan +joinpart
    putquick "NOTICE $nick :Enabled JoinPart Protection for $chan"
  }

  if {[lindex [split $arg] 1] == "off"} {
    if {![channel get $chan joinpart]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
    channel set $chan -joinpart
    putquick "NOTICE $nick :Disabled JoinPart Protection for $chan"
  }
}

proc quit:check {nick uhost hand chan reason} {
  global quitwords exemptwords
  if {[channel get $chan quitcheck]} {
    foreach exempt $exemptwords {
      if {[string match -nocase $exempt $reason]} {return}
    }
    foreach quitmatch $quitwords {
      if {([botisop $chan]) || (![validuser [nick2hand $nick]]) || (![isop $nick $chan]) || (![isvoice $nick $chan])} {
        if {([string match -nocase $quitmatch $reason]) && (![string match -nocase "*ghost*" $reason]) && (![string match -nocase "*collision*" $reason]) && (![string match -nocase "*svskill*" $reason])} {
          set mask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
          pushmode $chan +b $mask
        }
      }
    }
    flushmode $chan
  }
}

proc join:quit {nick uhost hand chan reason} {
  global jointime
  if {[channel get $chan joinquit] || [isbotnick $nick] || [botisop $chan] || ![isop $nick $chan] || ![isvoice $nick $chan] || ![validuser [nick2hand $nick]]} {
    set mask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
    set join [getchanjoin $nick $chan]
    set quit [unixtime]
    set joinquit [expr $quit - $join]
    if {$joinquit <= $jointime} {
      pushmode $chan +b $mask
    }
  }
  flushmode $chan
}

proc join:part {nick uhost hand chan {msg ""}} {
  global jointime
  if {![channel get $chan joinpart] || [isbotnick $nick] || ![botisop $chan]} {return}
    set mask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
    set join [getchanjoin $nick $chan]
    set part [unixtime]
    set joinpart [expr $part - $join]
    if {$joinpart <= $jointime} {
      pushmode $chan +b $mask
  }
  flushmode $chan
}

putlog ".:partquit.tcl:.v, 1.5.1 - istok @ IRCSpeed"
User avatar
CrazyCat
Revered One
Posts: 1301
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

You have unbalanced parentheses :) each time with [regexp c [getchanmode $chan]], the closing parenthesis is missing.

Correct lines are
quitcheck:pub

Code: Select all

  if {([lindex [split $text] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]quitcheck on/off"; return}
  if {([lindex [split $text] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]quitcheck on/off"; return}
joinquit:pub

Code: Select all

if {([lindex [split $text] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]joinquit on/off"; return}
  if {([lindex [split $text] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]joinquit on/off"; return}
User avatar
Fahad
Op
Posts: 129
Joined: Mon Aug 29, 2016 9:40 am

Post by Fahad »

Can you Edit the script and paste ?
User avatar
CrazyCat
Revered One
Posts: 1301
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Are you kidding me ?
Aren't you able to find these 4 lines and replace them ?
Post Reply