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 60
if {[string compare [string index $time 0] "!"] == 0} { set timer [string range $time 1 end] } { set timer [expr $time * 60] }
if {[lsearch -glob [utimers] "* gos *"] == -1} { utimer $timer gos }
proc gos {} {
global mysql channel time timer
foreach chan $channel {
set mysql(conn) [mysqlconnect -host $mysql(host) -port $mysql(port) -user $mysql(user) -password $mysql(pass)]
mysqluse $mysql(conn) $mysql(data)
foreach query [mysqlsel $mysql(conn) "SELECT * FROM cup_reklame ORDER BY id;" -list] {
putserv "PRIVMSG $chan :[lindex $query 1] "
}
}
if {[lsearch -glob [utimers] "* gos *"] == -1} { utimer $timer gos }
mysqlclose $mysql(conn)
}
putlog "\002Mysql advertising 1.0\002"
This is working grate for me but one problem is that i need to make the set time 60 dynamic, so i eg can type !cuprek on then it will type every 30 min and if it´s !cuprek off it will type every 60 min is that posible and is ther one ther can help me yoused a lot of time looking in here last night