bind pub - !addquote addquote_database

proc addquote_database {nick uhost handle channel text} {
if {[llength [split $text ""]] == 0} {return}
set fileid [expr {int(rand()*99999)}] 
while {[file exists D:/Robb/quotes/db/$fileid.txt]} { 
set fileid [expr {int(rand()*99999)}] 
}

set file [open  D:/Robb/quotes/db/$fileid.txt w+]
regsub -all {<([\x2B\x40\x25])(\w+)>} $text {<\2>} text

puts $file "$text"
close $file

putquick "PRIVMSG $channel :Quote added: \037http://robb.hyperunknown.se/quotes/?$fileid\037"
}