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 

Kicks & Bans Top10 html stats

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


Joined: 15 Feb 2007
Posts: 3

PostPosted: Thu Feb 15, 2007 4:01 pm    Post subject: Kicks & Bans Top10 html stats Reply with quote

I want tcl, that logs kicks and bans from specific channel, and generates html with Top10 stats of operators that was used this commands.

I think this will based on this tcl:

http://forum.egghelp.org/viewtopic.php?t=12774&highlight=kickban+html

Anyone can make this tcl ?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed Feb 28, 2007 11:12 am    Post subject: Reply with quote

Code:

#-------------------------------------------------------------------------------------------------------------
# COPYRIGHT C.LEONHARDT 2007 for the people who stole my script and
# posted it to the egghelp tcl archive without giving me any credit.
# Except the stolen copy looks like sh*t, doesn't work and is specific
# for wincrap.

# kickban top ten html list - requires the script I made here (or at least the same general log format):
# http://forum.egghelp.org/viewtopic.php?p=68656#68656
#
# Log Format (case-insensitive):
# Ban: set by $nick
# Kick: set by $nick

# And no, this counter does not differentiate between kicks and bans, it just totals everything by nick.
# I leave it up to others to further refine the script if you want it to distinguish kicks or bans. :P
# The html format is simply <pre> tags.. Feel free to change it below. You break it, you keep the pieces.

# Bind to run script once a day at midnight (uncomment the line below to enable)
#bind time - "01 00 * * *" proc:kblog

# Bind for running script manually
bind msg - .kblog proc:kblogmsg
proc proc:kblogmsg {nick uhost hand text} {
        proc:kblog 00 00 * * *
        return
}

proc proc:kblog {min hr day mon yr} {
        # change these to your file locations/names.
        set kickbanlog "/tmp/kickban.log"
        set htmlfile "/tmp/kblog.html"

        if {![file exists $kickbanlog]} {putcmdlog "There's no kick-ban log to work with!";return}
        set input [open $kickbanlog r]
        set logtemp [split [read $input] \n]
        catch {close $input}

        # array bit below borrowed from my quotes script.
        set kbtmp "";set kbnum "";set usermatch "";set kbusertmp "";set showkbuser "";set count 0
        foreach line $logtemp {
                if {$line != ""} {
                        set kbtmp [lindex $line 3]
                        if {[array names kbname $kbtmp] == ""} {
                                array set kbname "$kbtmp 1"
                        } else {
                                set kbnum [lindex [array get kbname $kbtmp] 1]
                                incr kbnum
                                array set kbname "$kbtmp $kbnum"
                        }
                }
        }
        foreach {name count} [array get kbname] {
                set usermatch "$name: total kicks/bans: $count"
                lappend kbusertmp $usermatch
        }
        array unset kbname

        # just in case we have no data, abort.
        if {$kbusertmp == ""} {putcmdlog "Hmm..No data..PUNT!";return}

        # sort the data
        if {$kbusertmp != ""} {
                set showkbuser "[lsort -integer -decreasing -index 3 $kbusertmp]"
        }

        set count 0
        foreach item [lrange $showkbuser 0 end] {
                incr count
                # This limits the output to the top 10. Change the number to whatever you want.
                if {$count < 11} {
                        lappend output "<pre>Top Ten Kick-Banners: $count\: $item</pre>"
                } else {
                        break
                }
        }

        # write the new html data
        set outfile [open $htmlfile w]
        foreach line [lrange $output 0 end] {
                puts $outfile $line
        }
        flush $outfile
        catch {close $outfile}
        putcmdlog "Wrote kickban html file.."
}
putlog "kbloghtml.tcl loaded"

Tested..Worked for me. YMMV


Last edited by rosc2112 on Mon Mar 05, 2007 4:31 am; edited 1 time in total
Back to top
View user's profile Send private message
tisho
Voice


Joined: 15 Feb 2007
Posts: 3

PostPosted: Sun Mar 04, 2007 8:34 pm    Post subject: Re Reply with quote

Dude, we "Stolen" only your idea from the fisrt tcl
http://forum.egghelp.org/viewtopic.php?t=12774&highlight=kickban+html
and complete the new one tcl.
But I promise you, that I will send version 2.0 of this script, and put your CREDITS there.
Thanks a lot again !
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Mon Mar 05, 2007 12:17 am    Post subject: Reply with quote

Give credit where credit is due.. Or, actually, considering how sloppy and horribly written "your" script was, don't even bother, I don't want to be associated with that mess. Write your own code from scratch.
Back to top
View user's profile Send private message
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