Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!
- # I'm an eggdrop compat source
- set dbuser {username} ;# this protects it from special characters by making it a string literal
- set dbpass {password}
- set reporterrors 1
- package require mysqltcl
- bind pub - "!request" pub_request
- proc pub_request {name host handle channel text} {
- global dbuser dbpass ;# expose vars to this procedure, you can upvar by $::varname as well instead of using global
- if {[catch {set db [::mysql::connect -host localhost -user $dbuser -password $dbpass -db radio]} errmsg]} {
- putlog "Error:$errmsg"
- if {$::reporterrors == 1} { puthelp "PRIVMSG $channel :Error:$errmsg" }
- }
- #you could wrap this in a catch statement as well.
- set result [::mysql::sel $db "SELECT song,name,message FROM request WHERE check='' LIMIT 1"];
- if {$result == 1} {
- puthelp "PRIVMSG $channel :\x02$nick\x02, Checked database. No new requests/messages."
- } else {
- ::mysql::map $db {song name message} {
- puthelp "PRIVMSG $channel :\x02\[Request\x02\] Song: $song Message: $message By: $name"
- }
- }
- ::mysql::close $db
- }
- putlog "Loaded noname script"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement