Code: Select all
set mysql(host) "***"
set mysql(port) "3306"
set mysql(user) "***"
set mysql(pass) "***"
set mysql(data) "***"
set mysql(vers) "2.1"
package require mysqltcl $mysql(vers)
set channel "#onedaycup #sucsa"
set time 1
if {[string compare [string index $time 0] "!"] == 0} { set timer [string range $time 1 end] } { set timer [expr $time * 60] }
if {[lsearch -glob [utimers] "* gomysql *"] == -1} { utimer $timer gomysql }
proc gomysql {} {
global mysql channel time text timer
mysqluse $mysql(conn) $mysql(data)
foreach chan $channel {
foreach query [mysqlsel $mysql(conn) "SELECT * FROM cup_reklame ORDER BY id;" -list] {
putserv "PRIVMSG $chan :[lindex $query 1] "
}
putserv "PRIVMSG $chan :Query ended."
}
if {[lsearch -glob [utimers] "* gomysql *"] == -1} { utimer $timer gomysql }
}
putlog "\002Test Script\002"