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.
Old posts that have not been replied to for several years.
-
Pitchat
- Op
- Posts: 122
- Joined: Tue Feb 18, 2003 11:24 pm
- Location: Hebertville Quebec Canada
-
Contact:
Post
by Pitchat »
Hi !
her`s my problem , i want a tcl that when i do in dcc something like
.makelog (some text)
it creates a logfile ( or txt file) with the date and handle of the user that make the .makelog command as filename
exemple
if i do in dcc
.makelog here i write some useless text
it will creat a file named pitchat 01-01-01.txt ( or .log) in a directory of my choice
thanks
Pitchat
-
greenbear
- Owner
- Posts: 733
- Joined: Mon Sep 24, 2001 8:00 pm
- Location: Norway
Post
by greenbear »
This should do it
Code: Select all
set logdir "logs/"
bind dcc -|- makelog dcc:makelog
proc dcc:makelog {hand idx arg} {
global logdir
set logmsg [lrange $arg 0 end]
set filename $logdir$hand\_[strftime %m-%d-%y].log
if {![file exists $filename]} {
set fp [open $filename w]
puts $fp "[strftime \[%H:%M\]] [join $logmsg]"
putdcc $idx "Writing '[join $logmsg]' to $filename"
} else {
set fp [open $filename a]
puts $fp "[strftime \[%H:%M\]] [join $logmsg]"
putdcc $idx "Adding '[join $logmsg]' to $filename"
}
close $fp
}