need to rehash bot to change log files for custom tcl?

Help for those learning Tcl or writing their own scripts.
Post Reply
x
xcoldfyrex
Voice
Posts: 4
Joined: Mon Jun 27, 2005 3:20 pm

need to rehash bot to change log files for custom tcl?

Post by xcoldfyrex »

im sure the coding can be better
in order for it to start writing to a different file, the bot needs to be rehashed, and i dont want this, it should just log to a file based on the realtime date

Code: Select all

###########################THIS TCL BY COLDFYRE
bind pubm - "*" save_message
bind join - "*" save_join
bind part - "*" save_part
bind sign - "*" save_sign
bind topc - "*" save_topc
bind kick - "*" save_kick
bind nick - "*" save_nick
bind mode - "*" save_mode
set date [clock format [clock seconds] -format "%d_%m_%y"]
set times [clock format [clock seconds] -format "%T"]
set thechan "#dialtone"
set joins "/www/htdocs/dialtone_radio/logs/irc_$date.log"

proc save_message {nick uhost handle chan text} {
        set date [clock format [clock seconds] -format "%d_%m_%y"]
        set times [clock format [clock seconds] -format "%T"]
        if {$chan == "#dialtone"} {
                set file [open $::joins a]
                puts $file "$times $nick: $text (00)"
                catch {close $file}
        }
}


proc save_join {nick uhost handle chan} {
        set date [clock format [clock seconds] -format "%d_%m_%y"]
        set times [clock format [clock seconds] -format "%T"]
        if {$chan  == "#dialtone"} {
                set file [open $::joins a]
                puts $file "$times JOIN $nick ($uhost)(00)"
                catch {close $file}
        }
}

proc save_part {nick uhost handle chan msg} {
        set date [clock format [clock seconds] -format "%d_%m_%y"]
        set times [clock format [clock seconds] -format "%T"]
        if {$chan == "#dialtone"} {
                set file [open $::joins a]
                puts $file "$times PART $nick ($uhost)(00)"
                catch {close $file}
        }
}

proc save_sign {nick uhost handle chan msg} {
        set date [clock format [clock seconds] -format "%d_%m_%y"]
        set times [clock format [clock seconds] -format "%T"]
        if {$chan == "#dialtone"} {
                set file [open $::joins a]
                puts $file "$times QUIT $nick ($uhost) REASON: $msg (00)"
                catch {close $file}
        }
}

proc save_topc {nick uhost handle chan topic} {
        set date [clock format [clock seconds] -format "%d_%m_%y"]
        set times [clock format [clock seconds] -format "%T"]
        if {$chan == "#dialtone"} {
                set file [open $::joins a]
                puts $file "$times $nick ($uhost) sets topic: $topic (00)"
                catch {close $file}
        }
}

proc save_kick {nick uhost handle chan target reason} {
        set times [clock format [clock seconds] -format "%T"]
        if {$chan == "#dialtone"} {
                set file [open $::joins a]
                puts $file "$times $nick ($uhost) kicked $target because $reason (00)"
                catch {close $file}
        }
}

proc save_nick {nick uhost handle chan newnick} {
        set date [clock format [clock seconds] -format "%d_%m_%y"]
        set times [clock format [clock seconds] -format "%T"]
        if {$chan == "#dialtone"} {
                set file [open $::joins a]
                puts $file "$times $nick changed nick to $newnick (00)"
                catch {close $file}
        }
}

proc save_mode {nick uhost handle chan mode victim} {
        set date [clock format [clock seconds] -format "%d_%m_%y"]
        set times [clock format [clock seconds] -format "%T"]
        if {$chan == "#dialtone"} {
                set file [open $::joins a]
                if {$victim == "" } {
                        puts $file "$times $nick sets mode: $mode (00)"
                } else {
                        puts $file "$times $nick sets mode $mode on $victim (00)"
}
                catch {close $file}
        }
}
User avatar
SaPrOuZy
Halfop
Posts: 75
Joined: Wed Mar 24, 2004 7:38 am
Location: Lebanon

Post by SaPrOuZy »

put

Code: Select all

set joins "/www/htdocs/dialtone_radio/logs/irc_$date.log"
before every

Code: Select all

set file [open $::joins a] 
Post Reply