Code: Select all
set file [open file.txt a]
Code: Select all
set file [open file.txt r]
set read [read -nonewline $file]
close $file
set file [open file.txt w]
foreach line [split $read \n] {
if {$line == ""} { continue }
if {[string equal -nocase $nick [lindex [split $line] 0]]} {
continue
} else {
puts $file "$line"
}
}
close $file
Code: Select all
# amount of posts to show
variable herebe_limit 5
package require http
setudef flag herebegames
bind pub - !MarketUU herebe:games1
bind pub - !MarketAT herebe:games2
bind pub - !MarketPlanet herebe:games3
bind pub - !MarketDiscussion herebe:games4
bind pub - !Awards herebe:games5
proc herebe:games1 {nick uhost handle chan text} {
herebe:games $nick $uhost $handle $chan 90 $text
}
proc herebe:games2 {nick uhost handle chan text} {
herebe:games $nick $uhost $handle $chan 91 $text
}
proc herebe:games3 {nick uhost handle chan text} {
herebe:games $nick $uhost $handle $chan 93 $text
}
proc herebe:games4 {nick uhost handle chan text} {
herebe:games $nick $uhost $handle $chan 94 $text
}
proc herebe:games5 {nick uhost handle chan text} {
herebe:games $nick $uhost $handle $chan 89 $text
}
proc herebe:games {nick uhost handle chan tag text} {
if {[lsearch -exact [channel info $chan] +herebegames] == -1} { return }
set query "http://herebegames.com/StarGateWarsNew/viewforum.php?f=$tag"
set ua "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
set http [::http::config -useragent $ua -useragent "utf-8"]
catch {set http [::http::geturl "$query" -timeout [expr 1000 * 5]]} error
if {[string match -nocase "*couldn't open socket*" $error]} {
putserv "privmsg $chan :Socket Error accessing '$query' .. It must be down.. :("
return 0
}
if { [::http::status $http] == "timeout" } {
putserv "privmsg $chan :Connection has timed out"
return 0
}
set html [::http::data $http]
::http::cleanup $http
regsub {(^.+?)<td class="row3" colspan="6"><b class="gensmall">Topics</b></td>} $html "" html
set counter 0
while {$counter < $::herebe_limit} {
regexp -nocase {<a title.+?href=.+?class=.+?">(.+?)</a>.+?<p class="topicdetails">.*?</a>.*?<a href="\.(.+?)">} $html -> subject url
set url "http://herebegames.com/StarGateWarsNew[string map {& &} $url]"
regsub -nocase {<a title.+?href=.+?class=.+?">.+?</a>.+?<p class="topicdetails">.*?</a>.*?<a href=".+?">} $html "" html
incr counter 1
putserv "privmsg $chan :\002$subject\002 - $url"
}
return 1
}
putlog "herebegames loaded."
<speechles> !marketUU
<sp33chy> selling 38 mil UU @ 720 bil per mil - http://herebegames.com/StarGateWarsNew/ ... 7#p1398657
<sp33chy> Buying 1mil UU (700 bil / 1mil uu) ~ online - http://herebegames.com/StarGateWarsNew/ ... 8#p1398628
<sp33chy> buying 4,5mil uu / 720bil per 1 mil - http://herebegames.com/StarGateWarsNew/ ... 8#p1398308
<sp33chy> Selling 1mil UU for 5k Turns - http://herebegames.com/StarGateWarsNew/ ... 6#p1398266
<sp33chy> Selling 15m UU 750b/m - http://herebegames.com/StarGateWarsNew/ ... 1#p1393781