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.

Help with Clones.. Tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

Help with Clones.. Tcl

Post by F|irT »

Code: Select all

# Set the next line as the kick msg you want to say 
set clone_msg "Clones" 
# Set the next line as the number of clones to scan for 
set clone_max 2 
# Set the next line as the channels you want to run in 
set clone_chans "#SuKooN" 

proc join_clone {nick uhost hand chan} { 
 global clone_msg clone_max clone_chans botnick 
 if {(([lsearch -exact [string tolower $clone_chans] [string tolower $chan]] != -1) || ($clone_chans == "*")) && (![matchattr $hand m|m $chan]) && (![matchattr $hand b]) && ($nick != $botnick)} { 
  set host [lindex [split $uhost @] 1] 
  set count 0 
  foreach i [chanlist $chan] { 
   if {[string equal -nocase [lindex [split [getchanhost $i $chan] @] 1] $host]} { 
    incr count 
    lappend cnicks "$i" 
   } 
  } 
  if {$count >= $clone_max} { 
   putquick "MODE $chan +b *!*@$host" 
   foreach cnick $cnicks { 
    putquick "KICK $chan $cnick :$clone_msg" 
   } 
  } 
 } 
} 
bind join - * join_clone
------------------------------------------------------------------------------------
There is nothing wrong with this tcl .. need ban time option bot auto remove the ban the timer i set ..

If any one can help me for it . thanks to them ..

F|irT
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

This seems like the easiest way to expire those bans.

Code: Select all

# Set the next line as the kick msg you want to say 
 set clone_msg "Clones" 
 # Set the next line as the number of clones to scan for 
 set clone_max 2 
 # Set the next line as the channels you want to run in 
 set clone_chans "#SuKooN" 

 # Set ban time (in seconds)
 set clone_bantime 120


 proc join_clone {nick uhost hand chan} { 
  global clone_msg clone_max clone_chans botnick 
  if {(([lsearch -exact [string tolower $clone_chans] [string tolower $chan]] != -1) || ($clone_chans == "*")) && (![matchattr $hand m|m $chan]) && (![matchattr $hand b]) && ($nick != $botnick)} { 
   set host [lindex [split $uhost @] 1] 
   set count 0 
   foreach i [chanlist $chan] { 
    if {[string equal -nocase [lindex [split [getchanhost $i $chan] @] 1] $host]} { 
     incr count 
     lappend cnicks "$i" 
    } 
   } 
   if {$count >= $clone_max} { 
    putquick "MODE $chan +b *!*@$host" 
    foreach cnick $cnicks { 
     putquick "KICK $chan $cnick :$clone_msg" 
    } 

    utimer $::clone_bantime [list putserv "MODE $chan -b *!*@$host"]

   } 
  } 
 } 
 bind join - * join_clone 

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Questions:

1. Why do you use -exact and turn the two string into lower case and not go with -nocase directly that basically dose the same thing?

2. ($nick != $botnick) really? Who are you and what have you done to SpiKe? :)

3. Why didn't check if bot is channel operator (botisop) before doing any checks and punishments?

I would change this section:

Code: Select all

foreach i [chanlist $chan] {
    if {[string equal -nocase [lindex [split [getchanhost $i $chan] @] 1] $host]} {
     incr count
     lappend cnicks "$i"
    }
   }
   if {$count >= $clone_max} {
    putquick "MODE $chan +b *!*@$host"
    foreach cnick $cnicks {
     putquick "KICK $chan $cnick :$clone_msg"
    } 
with:

Code: Select all

foreach user [chanlist $chan] {
	if {[string equal -nocase [lindex [split [getchanhost $user $chan] @] 1] $host]} {
		lappend kickList $user
	}
}

if {[info exists kickList]} { 
	set max 6
	set count [llength $kickList]
	if {$count >= $clone_max} {
		putquick "MODE $chan +b *!*@$host"
		while {$count > 0} {
			if {$count > $max} {
				set users [join [lrange $kickList 0 [expr {$max - 1}]] ","]
				set kickList [lrange $kickList $max end]
				incr count -$max
				} else {
					set users [join $kickList ","]
					set count 0
				}
				putquick "KICK $chan $users $clone_msg"
			}
		}
	}	
}
that will try to kick up to $max per line.

For example with the code as is right now if you have 3 people that needs to be kicked then the bot will send 3 kick lines to the server. But, with the change I mentioned above the bot will kick all 3 with just a single line sent to the server (in theory should be faster).
Once the game is over, the king and the pawn go back in the same box.
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

More to come.. ?

Post by F|irT »

Code: Select all

# Set the next line as the kick msg you want to say 
 set clone_msg "Clones" 
 # Set the next line as the number of clones to scan for 
 set clone_max 2 
 # Set the next line as the channels you want to run in 
 set clone_chans "#SuKooN" 

 # Set ban time (in seconds) 
 set clone_bantime 120 


 proc join_clone {nick uhost hand chan} { 
  global clone_msg clone_max clone_chans botnick 
  if {(([lsearch -exact [string tolower $clone_chans] [string tolower $chan]] != -1) || ($clone_chans == "*")) && (![matchattr $hand m|m $chan]) && (![matchattr $hand b]) && ($nick != $botnick)} { 
   set host [lindex [split $uhost @] 1] 
   set count 0 
   foreach i [chanlist $chan] { 
    if {[string equal -nocase [lindex [split [getchanhost $i $chan] @] 1] $host]} { 
     incr count 
     lappend cnicks "$i" 
    } 
   } 
   if {$count >= $clone_max} { 
    putquick "MODE $chan +b *!*@$host" 
    foreach cnick $cnicks { 
     putquick "KICK $chan $cnick :$clone_msg" 
    } 

    utimer $::clone_bantime [list putserv "MODE $chan -b *!*@$host"] 

   } 
  } 
 } 
 bind join - * join_clone 
i did not try caesar yet ... will try that soon ..

working fine the timer is on .. no issue .. but there is a problem i saw like to share .. it's baning cloud ip .. as well as ops match the clones cloud .. here are some result fot u ..
[07:07] * Joins: Jutt (uid187859@ealing.irccloud.com)
[07:07] * ChanServ sets mode: +o Jutt
[07:07] * MaSt3r sets mode: +b *!*@ealing.irccloud.com
[07:07] * Charsi-Larka was kicked by MaSt3r (Clones Are Not Allowed 120 Sec Ban ...!!!)
[07:07] * Jutt was kicked by MaSt3r (Clones Are Not Allowed 120 Sec Ban ...!!!)
if it is possibel to make some some ip protect option . or to protect not to kick ops/voice user .. it will be fair enuff for me ..

Thanks .. hoping for the reply soon ..

F|irT
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

caesar:

I didn't write the script, and just fixed the one issue F|irT asked to have fixed...
There is nothing wrong with this tcl .. need ban time option bot auto remove the ban the timer i set ..
All are valid fixes for this script though.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Try this, report back.

Code: Select all

# Set the next line as the kick msg you want to say 
set clone_msg "Clones" 
# Set the next line as the number of clones to scan for 
set clone_max 2 
# Set the next line as the channels you want to run in (* = allchannels)
set clone_chans "#SuKooN" 

# Set ban time (in seconds) 
set clone_bantime 120 

# Exempt +o users from this script ??
#  0 = No, do not exempt users with +o
#  1 = Yes, exempt users with +o
#  2 = Yes, also exempt users with +v
set clone_exemptops 1

# Set exempt users by standard "nick!user@host" mask ??
set clone_exemptmask {
*!*@DALnet
*!*@*.users.quakenet.org
*!*@*.irccloud.com
}
###########  End Settings  ###########


proc join_clone {nick uhost hand chan} { 
 global clone_msg clone_max clone_chans clone_exemptops
 if {$clone_chans ne "*" && [lsearch -nocase $clone_chans $chan] == -1} { return }
 if {[isbotnick $nick] || ![botisop $chan] || [matchattr $hand bm|m $chan]} { return }
 if {$clone_exemptops>0 && [matchattr $hand o|o $chan]} {  return  }
 if {$clone_exemptops>1 && [matchattr $hand v|v $chan]} {  return  }
 if {[llength $::clone_exemptmask]} {
   foreach mask $::clone_exemptmask {
     if {[string match -nocase $mask $nick!$uhost]} {  return  }
   }
 }
 set host [lindex [split $uhost @] 1] 
 set clonelist ""

 foreach user [chanlist $chan] { 
   if {[string equal -nocase [lindex [split [getchanhost $user $chan] @] 1] $host]} { 
     if {$clone_exemptops>0 && [isop $user $chan]} {  return  }
     if {$clone_exemptops>1 && [isvoice $user $chan]} {  return  }
     lappend clonelist $user 
   }
 } 

 if {[set count [llength $clonelist]] >= $clone_max} { 
   set max 6 
   putquick "MODE $chan +b *!*@$host" 
   while {$count > 0} {   ;# Thanks caesar #
     if {$count > $max} { 
       set users [join [lrange $clonelist 0 [expr {$max - 1}]] ","] 
       set clonelist [lrange $clonelist $max end] 
       incr count -$max 
     } else { 
       set users [join $clonelist ","] 
       set count 0 
     } 
     putquick "KICK $chan $users :$clone_msg" 
   } 
   utimer $::clone_bantime [list putserv "MODE $chan -b *!*@$host"] 
 } 

} 
bind join - * join_clone 

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Here is hopefully the final working copy...

Code: Select all

## DeClone v0.3 ##

# Set the next line as the kick msg you want to say 
set clone_msg "Clones" 
# Set the next line as the number of clones to scan for 
set clone_max 2 
# Set the next line as the channels you want to run in (* = allchannels)
set clone_chans "#SuKooN" 

# Set ban time (in seconds) 
set clone_bantime 120 

# Exempt +o users from this script ??
#  0 = No, do not exempt users with +o
#  1 = Yes, exempt users with +o
#  2 = Yes, also exempt users with +v
set clone_exemptops 1

# Set exempt users by standard "nick!user@host" mask ??
# If you do not have any mask to exempt: set clone_exemptmask {}
set clone_exemptmask {
*!*@DALnet
*!*@*.users.quakenet.org
*!*@*.irccloud.com
}
###########  End Settings  ###########


proc join_clone {nick uhost hand chan} { 
 global clone_msg clone_max clone_chans clone_exemptops
 if {$clone_chans ne "*" && [lsearch -nocase $clone_chans $chan] == -1} { return }
 if {[isbotnick $nick] || ![botisop $chan] || [matchattr $hand bm|m $chan]} { return }
 if {[llength $::clone_exemptmask]} {
   foreach mask $::clone_exemptmask {
     if {[string match -nocase $mask $nick!$uhost]} {  return  }
   }
 }
 set host [lindex [split $uhost @] 1] 
 set clonelist ""

 foreach user [chanlist $chan] { 
   if {[string equal -nocase [lindex [split [getchanhost $user $chan] @] 1] $host]} { 
     set hn [nick2hand $user $chan]
     if {$clone_exemptops>0 && ([isop $user $chan] || [matchattr $hn o|o $chan])} {
       return
     }
     if {$clone_exemptops>1 && ([isvoice $user $chan] || [matchattr $hn v|v $chan])} {
       return
     }
     lappend clonelist $user 
   }
 } 

 if {[set count [llength $clonelist]] >= $clone_max} { 
   set max 6 
   putquick "MODE $chan +b *!*@$host" 
   while {$count > 0} {           ;# Thanks caesar #
     if {$count > $max} { 
       set users [join [lrange $clonelist 0 [expr {$max - 1}]] ","] 
       set clonelist [lrange $clonelist $max end] 
       incr count -$max 
     } else { 
       set users [join $clonelist ","] 
       set count 0 
     } 
     putquick "KICK $chan $users :$clone_msg" 
   } 
   utimer $::clone_bantime [list putserv "MODE $chan -b *!*@$host"] 
 } 

} 
bind join - * join_clone 

putlog "DeClone v0.3 Loaded."

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

Thanks .. All Scripter .. Special Thanks to SpiKe^^

Post by F|irT »

Code: Select all

## DeClone v0.3 ## 

# Set the next line as the kick msg you want to say 
set clone_msg "10Clones Are Not Allowed 120 Sec Ban ...!!!" 
# Set the next line as the number of clones to scan for 
set clone_max 3 
# Set the next line as the channels you want to run in (* = allchannels) 
set clone_chans "#SuKooN" 

# Set ban time (in seconds) 
set clone_bantime 120 

# Exempt +o users from this script ?? 
#  0 = No, do not exempt users with +o 
#  1 = Yes, exempt users with +o 
#  2 = Yes, also exempt users with +v 
set clone_exemptops 1 

# Set exempt users by standard "nick!user@host" mask ?? 
# If you do not have any mask to exempt: set clone_exemptmask {} 
set clone_exemptmask { 
*!*@DALnet 
*!*@*.users.quakenet.org 
*!*@*.irccloud.com 
} 
###########  End Settings  ########### 


proc join_clone {nick uhost hand chan} { 
 global clone_msg clone_max clone_chans clone_exemptops 
 if {$clone_chans ne "*" && [lsearch -nocase $clone_chans $chan] == -1} { return } 
 if {[isbotnick $nick] || ![botisop $chan] || [matchattr $hand bm|m $chan]} { return } 
 if {[llength $::clone_exemptmask]} { 
   foreach mask $::clone_exemptmask { 
     if {[string match -nocase $mask $nick!$uhost]} {  return  } 
   } 
 } 
 set host [lindex [split $uhost @] 1] 
 set clonelist "" 

 foreach user [chanlist $chan] { 
   if {[string equal -nocase [lindex [split [getchanhost $user $chan] @] 1] $host]} { 
     set hn [nick2hand $user $chan] 
     if {$clone_exemptops>0 && ([isop $user $chan] || [matchattr $hn o|o $chan])} { 
       return 
     } 
     if {$clone_exemptops>1 && ([isvoice $user $chan] || [matchattr $hn v|v $chan])} { 
       return 
     } 
     lappend clonelist $user 
   } 
 } 

 if {[set count [llength $clonelist]] >= $clone_max} { 
   set max 6 
   putquick "MODE $chan +b *!*@$host" 
   while {$count > 0} {           ;# Thanks caesar # 
     if {$count > $max} { 
       set users [join [lrange $clonelist 0 [expr {$max - 1}]] ","] 
       set clonelist [lrange $clonelist $max end] 
       incr count -$max 
     } else { 
       set users [join $clonelist ","] 
       set count 0 
     } 
     putquick "KICK $chan $users :$clone_msg" 
   } 
   utimer $::clone_bantime [list putserv "MODE $chan -b *!*@$host"] 
 } 

} 
bind join - * join_clone 

putlog "DeClone v0.3 Loaded." 
----------------------------------------------------------------------------------
Tested in all format excellent work .. here are few result to show ..

[21:37] * MaSt3r sets mode: +b *!*@103.255.6.80
[21:37] * meri_bhn was kicked by MaSt3r (10Clones Are Not Allowed 120 Sec Ban ...!!!)
[21:37] * bhn_k_doud was kicked by MaSt3r (10Clones Are Not Allowed 120 Sec Ban ...!!!)
[21:37] * any_real_amil was kicked by MaSt3r (10Clones Are Not Allowed 120 Sec Ban ...!!!)
-------------------------------------------------------------------------------------
[14:00] * Joins: cRaZy` (~R-P@119.157.179.86)
[14:00] * F|irT sets mode: +v cRaZy`
- Clones from 119.157.179.86
- 1. cRaZy` (~R-P)
- 2. R-K (~R-P)
- 3. R-P (~R-P)
Not Kicking voice user match with clones... as i wanted .. good
----------------------------------------------------------------------------
[14:05] * Parts: +cRaZy` (~R-P@119.157.179.86)
[14:05] * Joins: cRaZy` (~R-P@119.157.179.86)
[14:05] * MaSt3r sets mode: +b *!*@119.157.179.86
[14:05] * R-K was kicked by MaSt3r (Clones Are Not Allowed 120 Sec Ban ...!!!)
[14:05] * R-P was kicked by MaSt3r (Clones Are Not Allowed 120 Sec Ban ...!!!)
[14:05] * cRaZy` was kicked by MaSt3r (Clones Are Not Allowed 120 Sec Ban ...!!!)
-------------------------------------------------------------------------------------
- Clones from id-234240.tooting.irccloud.com
- 1. boy19 (uid234240)
- 2. f-30 (uid234240)
- 3. Mard1 (uid234240)
---------------------------------------------------------------------------------
Protecting Some host i add like Cloud .. not reading clones on cloud host ..
-------------------------------------------------------------------------------------

i am running this srcipt on Dalnet .. No issue ... Thank Goes To SpiKe^^ to Helping it to make it write..

F|irT...!
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

very nice work again SpiKe^^ i tested it on my testnet and added a

privmsg $chan + *!*$host

and found it kept setting bans on already banned clone hosts is there a way to have it set once per clone host ?

also it pushes out the stacked kicks fine at the start but then it starts gettin much slower

tested with this:

Code: Select all

## DeClone v0.3 ##

# Set the next line as the kick msg you want to say
set clone_msg "10Clones Are Not Allowed 120 Sec Ban ...!!!"
# Set the next line as the number of clones to scan for
set clone_max 3
# Set the next line as the channels you want to run in (* = allchannels)
set clone_chans "#SuKooN"

# Set ban time (in seconds)
set clone_bantime 120

# Exempt +o users from this script ??
#  0 = No, do not exempt users with +o
#  1 = Yes, exempt users with +o
#  2 = Yes, also exempt users with +v
set clone_exemptops 1

# Set exempt users by standard "nick!user@host" mask ??
# If you do not have any mask to exempt: set clone_exemptmask {}
set clone_exemptmask {
*!*@DALnet
*!*@*.users.quakenet.org
*!*@*.irccloud.com
}
###########  End Settings  ###########


proc join_clone {nick uhost hand chan} {
 global clone_msg clone_max clone_chans clone_exemptops
 if {$clone_chans ne "*" && [lsearch -nocase $clone_chans $chan] == -1} { return }
 if {[isbotnick $nick] || ![botisop $chan] || [matchattr $hand bm|m $chan]} { return }
 if {[llength $::clone_exemptmask]} {
   foreach mask $::clone_exemptmask {
     if {[string match -nocase $mask $nick!$uhost]} {  return  }
   }
 }
 set host [lindex [split $uhost @] 1]
 set clonelist ""

 foreach user [chanlist $chan] {
   if {[string equal -nocase [lindex [split [getchanhost $user $chan] @] 1] $host]} {
     set hn [nick2hand $user $chan]
     if {$clone_exemptops>0 && ([isop $user $chan] || [matchattr $hn o|o $chan])} {
       return
     }
     if {$clone_exemptops>1 && ([isvoice $user $chan] || [matchattr $hn v|v $chan])} {
       return
     }
     lappend clonelist $user
   }
 }

 if {[set count [llength $clonelist]] >= $clone_max} {
   set max 6
   putserv "privmsg $chan +b *!*@$host"
   putquick "MODE $chan +b *!*@$host"
   while {$count > 0} {           ;# Thanks caesar #
     if {$count > $max} {
       set users [join [lrange $clonelist 0 [expr {$max - 1}]] ","]
       set clonelist [lrange $clonelist $max end]
       incr count -$max
     } else {
       set users [join $clonelist ","]
       set count 0
     }
     putquick "KICK $chan $users :$clone_msg"
   }
   utimer $::clone_bantime [list putserv "MODE $chan -b *!*@$host"]
 }

}
bind join - * join_clone
Last edited by simo on Wed May 27, 2020 12:06 pm, edited 1 time in total.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

DeClone v0.4

Post by SpiKe^^ »

Here is another try at the clone kicker script.

simo: please test this and report back.

Code: Select all

## DeClone v0.4 ##

# Set the next line as the kick msg you want to say 
set clone_msg "Clones" 
# Set the next line as the number of clones to scan for 
set clone_max 3
# Set the next line as the channels you want to run in (* = allchannels)
set clone_chans "#SuKooN" 

# Set ban time (in seconds) 
set clone_bantime 120 

# Exempt +o users from this script ??
#  0 = No, do not exempt users with +o
#  1 = Yes, exempt users with +o
#  2 = Yes, also exempt users with +v
set clone_exemptops 1

# Set exempt users by standard "nick!user@host" mask ??
# If you do not have any mask to exempt: set clone_exemptmask {}
set clone_exemptmask {
*!*@DALnet
*!*@*.users.quakenet.org
*!*@*.irccloud.com
}
###########  End Settings  ###########


proc join_clone {nk uh hand chan} { 
 global clone_msg clone_max clone_chans clone_exemptops declones
 if {$clone_chans ne "*" && [lsearch -nocase $clone_chans $chan] == -1} { return }
 if {[isbotnick $nk] || ![botisop $chan] || [matchattr $hand bm|m $chan]} { return }
 if {[llength $::clone_exemptmask]} {
   foreach mask $::clone_exemptmask {
     if {[string match -nocase $mask $nk!$uh]} {  return  }
   }
 }
 set host [string tolower [lindex [split $uh @] 1]]
 set chan [string tolower $chan]

 if {[info exists declones($chan,$host)]} {
   set nowls $declones($chan,$host)
 } else {  set nowls ""  }

 set new ""

 foreach user [chanlist $chan] { 
   if {[string equal -nocase [lindex [split [getchanhost $user $chan] @] 1] $host]} { 
     set hn [nick2hand $user $chan]
     if {$clone_exemptops>0 && ([isop $user $chan] || [matchattr $hn o|o $chan])} {
       return
     }
     if {$clone_exemptops>1 && ([isvoice $user $chan] || [matchattr $hn v|v $chan])} {
       return
     }
     if {[lsearch -nocase $nowls $user] == -1} {  lappend new $user  }
   }
 } 

 if {([llength $nowls]+[llength $new]) >= $clone_max} {
   if {![llength $nowls]} {
     putquick "MODE $chan +b *!*@$host" 
     utimer $::clone_bantime [list unban_clone $chan $host] 
   }
   if {[llength $new]} {
     qkick $chan [join $new ","] $clone_msg
     set declones($chan,$host) [concat $nowls $new]
   }
 } 
} 

proc unban_clone {chan host} {
 if {[lsearch -exact [join [chanbans $chan]] "*!*@$host"] > -1} {
   putserv "MODE $chan -b *!*@$host"
 }
 catch {unset declones($chan,$host)}
} 

bind join - * join_clone 

putlog "DeClone v0.4 Loaded."

You will also need to load this kick queuing script from an earlier thread.
http://forum.egghelp.org/viewtopic.php?t=20782

Code: Select all

########################################################## 

 ##  qkick ver 0.2 by SpiKe^^ - 25 May 2020 

 ##  A possible alternative for the Eggdrop tcl command: ## 
 ##          putkick <channel> <nick,nick,...> [reason]  ## 

 ##  New tcl command:                                    ## 
 ##          qkick <channel> <nick,nick,...> [reason]    ## 

 ########################################################## 
 proc qkick {ch {nk ""} {wy ""}} {  global qkick 

   set qmax 10 
   set qsec 1 
   set qwhy "Go away." 

   if {![validchan $ch]} { return 1 } 
   set ch [string tolower $ch] 
   set nkls [split $nk ","] 
   if {[info exists qkick($ch)] && [llength $qkick($ch)]} { 
     set nkls [concat $qkick($ch) $nkls] 
   } 

   if {$wy ne ""} { 
     set qwhy $wy 
     set qkick(why$ch) $wy 
   } elseif {[info exists qkick(why$ch)]} { 
     set qwhy $qkick(why$ch) 
   } 

   if {$nk eq "" || [llength $nkls]>=$qmax} { 
     while {[llength $nkls]} { 
       if {[llength $nkls]<$qmax && $nk ne ""} { break } 
       if {[llength $nkls]>$qmax} { 
         set kick [join [lreplace $nkls $qmax end] ","] 
         set nkls [lrange $nkls $qmax end] 
       } else { 
         set kick [join $nkls ","] 
         set nkls [list] 
       } 
       putserv "KICK $ch $kick :$qwhy" 
     } 
   } 

   if {![info exists qkick($ch)]} { 
     set qkick($ch) $nkls 
     utimer $qsec [list qkick $ch] 
   } elseif {$nk eq ""} { 
     unset qkick($ch) 

     catch {unset qkick(why$ch)} 

   } else { 
     set qkick($ch) $nkls 
   } 
   return 0 
 } 

 putlog "qkick ver 0.2 loaded." 

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

hey there SpiKe^^
i tested your last posted tcl and it only sets the bans and kicks the first time i used it and after i cleared bans and rejoined same clones it didnt seem to trigger anymore
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

if the bans are manually removed it hangs and wont set the bans again if clones rejoin

and on the timed unban perhaps its an idea to use pushmode to have it remove in stacked order rather then 1 by 1

and the duplicate bans seems to be solved now
Post Reply