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 

Help with Clones.. Tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
F|irT
Voice


Joined: 30 Apr 2015
Posts: 18
Location: Pakistan

PostPosted: Sun Jan 14, 2018 9:14 am    Post subject: Help with Clones.. Tcl Reply with quote

Code:
# 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
Back to top
View user's profile Send private message Yahoo Messenger
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 516
Location: Tennessee, USA

PostPosted: Sun Jan 14, 2018 1:59 pm    Post subject: Reply with quote

This seems like the easiest way to expire those bans.

Code:

# 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
Back to top
View user's profile Send private message Visit poster's website
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3412
Location: Area 51

PostPosted: Mon Jan 15, 2018 2:07 am    Post subject: Reply with quote

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? Smile

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

I would change this section:
Code:

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:

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).
_________________
Care to support me? Buy something with my referal link my from G2A then. Wink
Back to top
View user's profile Send private message
F|irT
Voice


Joined: 30 Apr 2015
Posts: 18
Location: Pakistan

PostPosted: Mon Jan 15, 2018 10:32 pm    Post subject: More to come.. ? Reply with quote

Code:

# 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 ..
Quote:

[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
Back to top
View user's profile Send private message Yahoo Messenger
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 516
Location: Tennessee, USA

PostPosted: Mon Jan 15, 2018 11:48 pm    Post subject: Reply with quote

caesar:

I didn't write the script, and just fixed the one issue F|irT asked to have fixed...
Quote:
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
Back to top
View user's profile Send private message Visit poster's website
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 516
Location: Tennessee, USA

PostPosted: Tue Jan 16, 2018 2:26 pm    Post subject: Reply with quote

Try this, report back.

Code:

# 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
Back to top
View user's profile Send private message Visit poster's website
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 516
Location: Tennessee, USA

PostPosted: Wed Jan 17, 2018 12:30 pm    Post subject: Reply with quote

Here is hopefully the final working copy...
Code:

## 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
Back to top
View user's profile Send private message Visit poster's website
F|irT
Voice


Joined: 30 Apr 2015
Posts: 18
Location: Pakistan

PostPosted: Fri Jan 19, 2018 5:22 am    Post subject: Thanks .. All Scripter .. Special Thanks to SpiKe^^ Reply with quote

Code:

## 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...!
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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