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.

Ban + html generating

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
h
hellrazor
Voice
Posts: 3
Joined: Thu Nov 30, 2006 9:56 pm

Ban + html generating

Post by hellrazor »

Hello there :) First of all, I am not very good at tcl coding. I need tcl like .. hmm KillLog, but instead of loggin kills, to log the kicks and bans. I mean - when someone get kicked from my channel, the bot should log the nick who was kicked, the nick who kicked (and the hosts of both) and the reason for kicks. After that, it should generate a webpage with .. with the same information. If there is .. someone who could write suck a think (because i can't) please, share your knowledge with me :)
Thanks in advance!
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Code: Select all

bind kick - * logit
bind mode - "* +b" logit

proc logit {nick uhost hand chan arg1 arg2} {
       if {$arg1 == "+b"} {
                set line "<pre>BAN: Set by $nick ($hand - $uhost) on channel $chan against $arg2 </pre>"
       } else {
                set line "<pre>KICK: Set by $nick ($hand - $uhost) on channel $chan against $arg1 for $arg2 </pre>"
       }
       set kickbanlog [open /path/to/my/kickban.log a]
       puts $kickbanlog $line
       catch {close $kickbanlog}
}
#antiwordwrap#########################################################################################################
Should work, not tested..Obviously doesn't have the html header (which probably won't be necessary anyway.) That gives you the basics, modify to suit.
h
hellrazor
Voice
Posts: 3
Joined: Thu Nov 30, 2006 9:56 pm

Post by hellrazor »

Thanks, it works :) One more thing, can it log the date and the time?
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Sure, just add [ctime [unixtime]] into the 'set line' parts:

set line "<pre>BAN: [ctime [unixtime]] and so forth"
h
hellrazor
Voice
Posts: 3
Joined: Thu Nov 30, 2006 9:56 pm

Post by hellrazor »

Everything works okay .. but there is one more thing, it logs bans only from one channel. Is there anyway to log from 2 or more channels? Btw, thanks a lot for the tcl. Now we can control much better the spam/invite from one ip/host.
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

It should log all channels, hence the * in the bind (read the documentation for bind)
t
tisho
Voice
Posts: 3
Joined: Thu Feb 15, 2007 3:53 pm

Thanks to rosc2112 for the idea !

Post by tisho »

Code: Select all

# ============================================================================
# KickBanLog.tcl v1.0 (12/Feb/2007) by Yxaaaaaaa & Tisho & Thanks  to rosc2112 
# -------------- COPYRIGHT C.LEONHARDT 2007 --------------------
# Original concept by rosc2112 (C.LEONHARDT)
# http://forum.egghelp.org/viewtopic.php?p=68656#68656
#
# Description:
# This tcl logs every Kick & Ban in chosen channel, and generates html file)
#
# Yxaaaaaaa UniBG @ #EggFAQ ( http://www.egghlep-bg.com )
# Tisho UniBG @ #DJ ( http://DjTisho.com )
# (Please e-mail us your suggestions and bugs - djtisho|at|gmail.com
# ============================================================================

# Starting configuration ...

# Channels (separated by space)
set kbechans "#channel1 #channel2"

# Main log dir (full path to your logs dir, e.g. /home/user/public_html/log )
set kbepath "/home/user/public_html/log"

# Setting the HTTP charset parameter ( http://www.w3.org/International/O-HTTP-charset )
set charset "windows-1251"

# Binds
bind kick - * e:log
bind mode - "* +b" e:log

# Start tcl script - DO NOT change anything below !
proc e:createpage c {
    if {![string match *$c* $::kbechans]} {return}
      set efile "$::kbepath/$c/index.html"
      set fid [open $efile w]
    puts $fid "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$::charset\" />\n
    <body text=\"#FFFFFF\" bgcolor=\"#000000\" topmargin=\"0\" leftmargin=\"0\">\n
    <p align=\"center\"><u><font size=\"5\" face=\"Verdana\">Channel #$c Kicks & Bans log</font></u></p>\n"
    close $fid
    }
    proc e:log {n u h c w t} {
      set c [string map [list "#" {}] [string tolower $c]]
    if {![file isdir $::kbepath/$c]} { catch {[file mkdir $::kbepath/$c]}}
      set efile "$::kbepath/$c/index.html"
    if {![file exists $efile]} { e:createpage $c}
    if {$w == "+b"} {
 set line "<pre><font color='green'>BAN: [ctime [unixtime]] Set by $n ($h - $u) on channel #$c against $t</font></pre>"
    } else {
  set line "<pre><font color='red'><u>KICK:</u> [ctime [unixtime]] Set by $n ($h - $u) on channel #$c against $w for <u>$t</u> </font></pre>"
     }
      set kickbanlog [open $efile a]
     puts $kickbanlog $line
   catch {close $kickbanlog}
     }

# putlog
putlog "KickBanLog.tcl v1.0 by <\002Yxaaaaaaa & Tisho & rosc2112\002> Loaded."
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

Post by m4s »

rosc2112 wrote:

Code: Select all

bind kick - * logit
bind mode - "* +b" logit

proc logit {nick uhost hand chan arg1 arg2} {
       if {$arg1 == "+b"} {
                set line "<pre>BAN: Set by $nick ($hand - $uhost) on channel $chan against $arg2 </pre>"
       } else {
                set line "<pre>KICK: Set by $nick ($hand - $uhost) on channel $chan against $arg1 for $arg2 </pre>"
       }
       set kickbanlog [open /path/to/my/kickban.log a]
       puts $kickbanlog $line
       catch {close $kickbanlog}
}
#antiwordwrap#########################################################################################################
Should work, not tested..Obviously doesn't have the html header (which probably won't be necessary anyway.) That gives you the basics, modify to suit.
Hello to everyone!

I would like to ask someone to modify this scripts for me.
I would like to store the "-b" actions too. It is good to know who removed the ban and when.

Thanks for your help! :)
d
dreamwatcher
Voice
Posts: 1
Joined: Thu Jul 20, 2017 1:33 pm

Hope to get a reply

Post by dreamwatcher »

Well supposing with this script lets modify it.

The eggdrop bot logs each kick and ban in channel 1. Channel 1 is the main channel. Channel 2 is the help channel for channel 1. The user came to channel 2 but the person who kicked is not there. As an operator i want to help.

So i type !searchban nick
the bot replies.

Searching for ban report on $nick in channel 1 ...
Ban Found on $nick with ban mask $banmask
Reason: $kickreason Placed By: $kick-maker Date & Time: $date $time

Please help me on this. would be very greatful. should reply on help channel on mains only. i'll add the colours myself. thanks
Post Reply