but i have a prob. this bit is wrong if {$info=="NEWS && position == 1"} and not sure how to fix it.
the bot announces like so,
#2: NEWS :: World News :: Today 1hr 4mins 22secs ago - BBCNews: UK the empty world ::
but my code will fail if where "the empty world" would change and become say 5 words
Code: Select all
bind pubm - * news_insert
proc pre_insert {nick host handle channel text} {
global db_handle
proc filter_mirc_codes {} {
upvar text text
regsub -all -- "(\002|\017|\026|\037|\003(\[0-9\]\[0-9\]?(,\[0-9\]\[0-9\]?)?)?)" $text "" text
}
filter_mirc_codes
set position [lindex [string map {# {} : {}} $text] 0]
set info [lindex $text 1]
if {$info=="NEWS && position == 1"} { <--- [b] I KNOW THIS BIT IS WRONG [/b]
set 1 [lindex [split $text] 6] [lindex [split $text] 7]
set 2 [lindex $text 3]
set 3 [lindex $text 12]
set 4 [lindex [split $text] 13] [lindex [split $text] 14]
set sql "blah"
}
mysqlendquery $db_handle
}