Example lines files:
When you run it seems that the bot is in an infinite loop.Juan Miércoles 7 de Setiembre a las 04:06:38
Pedro Jueves 8 de Setiembre a las 05:08:54
Maria Viernes 9 de Setiembre a las 15:11:49
Jack Viernes 9 de Setiembre a las 16:50:42
Axel Viernes 9 de Setiembre a las 18:22:02
I want to solve this bug .
In addition , I wish to show me the list in reverse order to what the show now .
I wish that first show last broadcast date and time.
Today I list the order of emissions , in the order they are lines.Axel Viernes 9 de Setiembre a las 18:22:02
Jack Viernes 9 de Setiembre a las 16:50:42
Maria Viernes 9 de Setiembre a las 15:11:49
Pedro Jueves 8 de Setiembre a las 05:08:54
Juan Miércoles 7 de Setiembre a las 04:06:38
The code:
Code: Select all
proc pub:brodcasting {nick uhost hand chan text} {
global canal_admin
if { $chan == $canal_admin } {
if {[file exist listaDJS]} {
set file [open listaDJS "r"]
set data [read $file]
set first [lindex $data 0]
if {$first == ""} {
set line_to_delete 0
set data [lreplace $data $line_to_delete $line_to_delete]
set fp [open $fname "w"]
puts $fp [join $data "\n"]
close $fp
}
set data [split $data "\n"]
set x 0
while {[llength $data] > 0} {
if {([llength $data] == 0) && ($x == 0)} { putquick "PRIVMSG $canal_admin :The list is empty."; return }
if {$data == ""} { continue }
putquick "PRIVMSG $canal_admin :\0032Dj \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 Date \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011 \011\011 \011 \011 \011 \011 \011 \011 \011 \011 Time"
putquick "PRIVMSG $canal_admin :[lindex $data $x]"
set x [expr {$x + 1}]
}
close $file
putquick "PRIVMSG $canal_admin :\0032____End of List____"
} else {
putmsg $canal_admin "Data Base is missing!"
}
} else {
return
}
}