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.

Mass Kick Protection

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Meh.. I should take a break. I'm too tiered from work. :(
Once the game is over, the king and the pawn go back in the same box.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

emmm so many errors, perhaps caesar must be tired :) take a break bro. Speechless thanks for pointing out the errors. Caesar take ure time with the code, ill wait. Sincere appreciation for both of u thanks :)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

namespace eval MassKick {

  # self explanatory
  set mass(limit) "3:10"
  set memo(mass) "The AOP of %nick user on %chan channel has been deleted due to attempt to masskick."
  set memo(bot) "The AOP of %nick user on %chan channel has been deleted cos he kicked me."

  # don't count or do anything to people with local/global friend flag or whatever you wish
  set mass(friends) "f|f"

  # don't edit below this line
  setudef flag massKick
  setudef str massKicker
  setudef str massCount

  # binds
  bind kick * * [namespace current]::kicked
  bind part - * [namespace current]::remove
  bind sign - * [namespace current]::remove
  bind nick - * [namespace current]::nickCh

  # AOP removal and memo
  proc takeAction {chan nick pos} {
    dropAOP $chan $nick "1"
    doThis "2" $chan $nick $pos
  }

  # bot kicked
  proc botKicked {chan nick} {
    dropAOP $chan $nick "2"
    resetChan $chan
  }

  # reset
  proc resetChan {chan} {
    channel set $chan massKicker {}
    channel set $chan massCount {}
  }

  # remove AOP, deop and send memo
  proc dropAOP {chan nick act} {
    variable memo
    switch -- $act {
      "1" {
        set message [string map -nocase [list "%chan" "$chan" "%nick" "$nick"] $memo(mass)]
      }
      "2" {
        set message [string map -nocase [list "%chan" "$chan" "%nick" "$nick"] $memo(bot)]
      }
    }
    putserv "Memoserv send $chan $message"
    putserv "Chanserv aop $chan del $nick"
    putserv "Chanserv deop $chan $nick"
  }

  # triggers:
  # 1 - add, 2 - remove, 3 - replace nick, 4 - replace count
  proc doThis {act chan nick {pos ""} {count ""} {newNick ""}} {
    set massKicker [channel get $chan massKicker]
    set massCount [channel get $chan massCount]
    switch -- $act {
      "1" {
        lappend massKicker $nick
        lappend massCount 1
      }
      "2" {
        set massKicker [lreplace $massKicker $pos $pos]
        set massCount [lreplace $massCount $pos $pos]
      }
      "3" {
        set massKicker [lreplace $massKicker $pos $pos $newNick]
      }
      "4" {
        set massCount [lreplace $massCount $pos $pos $count]
      }
    }
    channel set $chan massKicker $massKicker
    channel set $chan massCount $massCount
  }

  # triggers:
  # 1 - part & sign, 2 - nick change
  proc eventThis {event chan nick {newNick ""}} {
    set massKicker [channel get $chan massKicker]
    if {$nick ni $massKicker} return
    set pos [lsearch $massKicker $nick]
    switch -- $event {
      "1" {
        doThis "2" $chan $nick $pos
      }
      "2" {
        doThis "3" $chan $nick $pos "0" $newNick    
      }
    }
  }

  # part & sign
  proc remove {nick uhost handle chan {text ""}} {
    if {![channel get $chan massKick]} return
    if {[isbotnick $nick]} {
      resetChan $chan
      } else {
      eventThis "1" $chan $nick
    }
  }

  # nick
  proc nickCh {nick uhost handle chan newnick} {
    if {![channel get $chan massKick]} return
    if {[isbotnick $nick]} return
    eventThis "2" $chan $nick $newNick
  }


  # kick
  proc kicked {nick uhost hand chan target reason} {
    if {![channel get $chan massKick]} return
    variable mass
    if {[matchattr $hand $mass(friends) $chan]} return
    if {[isbotnick $nick]} return
    if {$nick eq "Chanserv"} return
    if {[isbotnick $target]} {
      botKicked $chan $nick
      return
    }
    set massKicker [channel get $chan massKicker]
    if {$nick ni $massKicker} {
      doThis "1" $chan $nick
      return
    }
    set pos [lsearch $massKicker $nick]
    set massCount [channel get $chan massCount]
    set count [lindex [split $massCount] $pos]
    set info [split $mass(limit) :]
    if {$count >= [lindex $info 0]} {
      takeAction $chan $nick $pos
      return
      } else {
      incr count
    }
    utimer [lindex $info 1] [list [namespace current]::doThis "2" $chan $nick $pos]
    doThis "4" $chan $nick $pos $count
  }
}
Hope I've finally nailed down all bugs. :roll: 12 hours of work every day for past 3 weeks is finally gaining on me.. I need a break. :?

As always, haven't tested anything, so you will be my guinea piggy. :) Just load it on a test bot and report back if anything goes wrong.

PS: Do a .chanset #channel +massKick to activate it on #channel

Edit: fixed for good hopefully. :)
Edit: #2 adjusted the defaults.
Last edited by caesar on Fri Mar 16, 2012 12:21 pm, edited 2 times in total.
Once the game is over, the king and the pawn go back in the same box.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

im afraid there is still errors :
[15:00] <(im> [07:00:31] Tcl error [::MassKick::kicked]: bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:31] Tcl error [::MassKick::kicked]: bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:31] Tcl error [::MassKick::kicked]: bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:32] -ChanServ (service@dal.net)- vinkan has been successfully removed from the AOP list of #idsf
[15:00] <(im> [07:00:32] -ChanServ (service@dal.net)- DEOP of vinkan on #idsf was successful.
[15:00] -ChanServ:#makaveli- import has deopped vinkan
[15:00] <(im> [07:00:33] Tcl error in script for 'timer144':
[15:00] <(im> [07:00:33] bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:33] Tcl error in script for 'timer145':
[15:00] <(im> [07:00:33] bad index "": must be integer?[+-]integer? or end?[+-]integer?
[15:00] <(im> [07:00:35] -MemoServ (service@dal.net)- Im does not wish to receive memos.
[15:00] -MemoServ- New memo from Import. For more information, use: /msg MemoServ@services.dal.net LIST
It sent me 3 memos of same thing so thts an error too. Thanks and take ure time :)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Looks like I'll have to load this on a bot myself to debug this. :roll:
Once the game is over, the king and the pawn go back in the same box.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Alright, I've loaded this on an eggdrop, ran some tests and finally I've nailed down all bugs. It should work smoothly now.
Once the game is over, the king and the pawn go back in the same box.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

now its working fine, but how can i set that it only deletes op when they reach certain kicks. for example i wanted 4 kicks in 1 sec or 2 sec but currently even 2 kicks its deleting the aop and sending memo. Working fine but where are the settings tht i can set and play ard with ? is it here --> set mass(limit) "1:20"

Thanks : )
R
Regex
Voice
Posts: 19
Joined: Sat Mar 19, 2011 1:23 pm

Post by Regex »

@caesar how can we use this without .chanset #channel <<

i need this script without .chanset option. my bot have to work in everychannel.. :)
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

.chanset * +masskick <-- for to run this script on all channels ...
Life iS Just a dReaM oN tHE wAy to DeaTh
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

@gamble27 : yes, isn't that option self explanatory? :P I left it with 1 to see if it's working or not.

@Clubber : first remove setudef flag massKick line then find and remove all instances of:

Code: Select all

if {![channel get $chan massKick]} return 
and it will work on all channels or do what heartbroken said. :)
Once the game is over, the king and the pawn go back in the same box.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

working extremely perfect now caesar, just wondering if we can add a check on the tcl to only works on aop. it shud nt affect sops and above. Tcl should only affect aops. Its wonderful job caesar :) Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Is there a command to to get the level of a certain user?
Once the game is over, the king and the pawn go back in the same box.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Is this useful?

http://thommey.tclhelp.net/?page=scripts

and see: Arbitrary chanmodes (+q, +a)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Not exactly, cos that script only maintains a list with users that the bot has seen them gaining a +/- a and o flags. I was looking for a way to view the access of a person and found the command I was looking for in Dalnet's Chanserv Info page.
Syntax: /chanserv acc/access #channel [nick]

Information: This command lets an AOp or higher see what access he/someone else has to the channel. The access is displayed numerically, below are the definitions:
-2 = Channel is frozen or closed
-1 = AutoKICKed from the channel
0 = basic
10 = AutoOp
20 = SuperOp
30 = User has MANAGER access
40 = Has founder access via a NickServ access list mask
50 = Has founder access via identification to NickServ
60 = Has founder access via identification to ChanServ

If the USER is not online, the access will be 0.
Note: You must be an AOp or higher to use that command.
Give me some time and will make it "forgive" higher ranked users. :)
Once the game is over, the king and the pawn go back in the same box.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

sure caesar take your time,another way to find out the access level its /chanserv why #channel nick, if it returns Sop,manager or founder. ignore it. It should only be activated for aops. Appreciate your work and take your time. Thanks :)
Post Reply