Code: Select all
#set the file you want to write to
set kchtmlfile "/home/stylez/eggdrop/kc-chan.html"
#Channel to show stats for
set kcchan "#kc"
#How often (in minutes) does the html file get updated.
set kchtmlrefresh 10
# The font to use on the html page.
set kchtmlfont "verdana,helvetica,arial"
#this generates an html file with all the people on the chan
#and the current topic.
proc kchtml {} {
global kcchan botnick kchtmlfile kchtmlrefresh server
global kctimer
global kchtmlfont
#set the topic that is in the channel
set topic [topic $kcchan]
set _file [open $kchtmlfile~new w]
puts $_file "<h5><font color=#3399ff>$kcchan Topic:<br>$topic</font></h5>"
puts $_file "<table border=0 cellpadding=0 cellspacing=0 width=150><tr><td width=100><h5><font color=#3399ff>Name</font></h5></td><td width=50><h5><font color=#3399ff>Idle</font></h5></td></tr>"
foreach nick [lsort [chanlist $kcchan]] {
puts $_file " <tr>"
puts $_file " <td><h6><font color=#3399ff>[expr [isop $nick $kcchan]?"@":""][expr [isvoice $nick $kcchan]?"+":""]$nick[expr [string match $nick $botnick]?" (Bot)":""]</font></h6></td>"
puts $_file " <td><h6><font color=#3399ff>[expr [getchanidle $nick $kcchan]>10?"[getchanidle $nick $kcchan]m":"-"]</font></h6></td>"
}
puts $_file "</table>"
#puts $_file ""
#puts $_file ""
#puts $_file ""
close $_file
file rename -force $kchtmlfile~new $kchtmlfile
putlog "$kcchan Stats Updated"
sendftp /home/stylez/eggdrop/kc-chan.html ftp.kronicconcerz.com login pass /httpdocs/kc-chan.html
timer $kchtmlrefresh kchtml
}
utimer $kchtmlrefresh kchtml
This is the sendftp.tcl script for anyone unfamiliar with it:
Code: Select all
#
# Sendftp v1.01 (12/6/97) by Ernst <ernst@studbox.uni-stuttgart.de>
# Ernst's eggdrop page: http://www.sodre.net/ernst/eggdrop/
# =============================================================================
# This is a proc to send a file via FTP to another server. Useful in many
# situations, for example to upload a HTML file generated by eggdrop to your
# www server if it is not the same as your eggdrops machine.
# Change this to something to use to check if a host is alife.
# set pingcheck "" to disable this checking.
# "/bin/ping -c 1" works on Linux. Try just "/bin/ping" on other machines
# Set to "" to disable this checking
set pingcheck "/bin/ping -c 1"
# Include it with 'source scripts/sendftp.tcl'. Call it with all parameters:
#
# sendftp <localfile> <server> <user> <password> <remotefile>
#
# 'localfile' and 'remotefile' *must* both be given as FULL paths to the
# filenames, the first on the local, the second on the remote server.
#
# For example:
#
# sendftp /home/bill/stats.htm www.ms.com bill secret /bgates/WWW/stats.htm
# (local-file server user pass remote-file)
proc sendftp { localfile server user pass remotefile } {
global pingcheck
if {![file exist $localfile]} {
return "sendftp: File $localfile does not exist."
}
if {$pingcheck != ""} {
if {[catch {exec [lindex $pingcheck 0] [lrange $pingcheck 1 end] $server > /dev/null 2> /dev/null}]} {
return "sendftp: Machine $server seems to be dead."
}
}
set noftp [catch {set ftpprog [exec which ftd]}]
if {$noftp} {
if {[file executable /usr/bin/ftp]} {
set ftpprog /usr/bin/ftp
set noftp 0
}
if {[file executable /bin/ftp]} {
set ftpprog /bin/ftp
set noftp 0
}
}
if {$noftp} { return "sendftp: You don't seem to have the 'ftp' tool" }
set pipe [open "|$ftpprog -n $server" w]
puts $pipe "user $user $pass"
puts $pipe "bin"
puts $pipe "put $localfile $remotefile"
puts $pipe "quit"
close $pipe
return 1
}
Code: Select all
timer 2 html
proc html {} {
sendftp /home/stylez/eggdrop/kc-chan.html ftp.kronicconcerz.com login pass /httpdocs/kc-chan.html
}
Any insight?