User:Dotted/NewsBot
From WoWWiki
Purpose
Spam various IRC channels on freenode and Quakenet.
About me
I'm programmed in the very sexy mIRC scripting language
What can I do?
- !al <continent> <realm> <nickname>
Creates a link to the armory with those parameters. Please write realm names in full, inclusive of special characters (Spaces, apostrophes)
Cooldown: 1 minute per request, and 10 minutes per link.
- !ap <bracket> <points> for points calculator
Calculates your arena points based on your teams rating.
- !chanstats
Updates the current stat page of the channel, and/or displays link of the current channel's stat page.
- !seen <nick>
Check when newsbot last saw <nick>, and what his/hers last words were. (DISABLED)
Network specials
Freenode
- !jobqueue
Downloads the jobqueue size from Special:Statistics, and displays it in the active channel.
Can be supplied with an URL, but isn't reliable. - !wwstats
Same as !chanstats. - Wiki links
Convert a a wiki link; [[Illidan Stormrage]] into a clickable link.
Quakenet
- N/A
To do, but will probably never happen because i slack too much - yet i play WoW and watch Anime :/
- Addon Search
- Armory Parsing
- WoWDB Search
Code snippets
Bot Code
Wiki link converter
; Script by Dotted ; Based on Wikilinks 1.3.1 ; By CXI, based on a script by Masterhomer ; This script is dual-licensed under the GPL, ; version 2 or (at your option) any later version. ; See http://www.gnu.org/licenses/gpl.txt for more details. on ^$*:TEXT:/[\{\}\[\]]{2}/:#,?,=: { var %contents = $1- tokenize 32 $remove($1,[[,]],{{,}}) if ($regex(%contents,(.*\[\[(.*? $+ $1 $+ .*?)(\|.*)?\]\].*|.*(\{\{.*? $+ $1 $+ .*?)\}\}.*))) && ($mid(%contents,3,1) != $chr(35)) { msg $chan $nick meant: $+(http://www.wowwiki.com/,$replace($gettok($regml(2),1,124),{{,Template:,$chr(32),_)) } }
Arena point calculator (DEPRECATED)
; Script by Dotted ; This script is dual-licensed under the GPL, ; version 2 or (at your option) any later version. ; See http://www.gnu.org/licenses/gpl.txt for more details. on *:TEXT:!ap*:#: { var %ts = $2 var %x = $3 if ($istok(2vs2 3vs3 5vs5 2v2 3v3 5v5 2 3 5,%ts,32)) { if (%x != $null) { var %tsp = $iif($istok(2vs2 2v2 2,%ts,32),76,$iif($istok(3vs3 3v3 3,%ts,32),88,$iif($istok(5vs5 5v5 5,%ts,32),100,Error))) if (%x > 1500) && (%x <= 3901) { var %y = $int($calc($calc(1511.26 / (1 + 1639.28 * (2.71828 ^ (-0.00412 * %x )))) * %tsp / 100 )) notice $nick $+ : $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points! } elseif (%x > 0) && (%x <= 1500) { var %y = $int($calc($calc(0.22 * %x + 14) * %tsp / 100 )) notice $nick $+ : $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points! } else { notice $nick Team Rating out of bounds. } } else { notice $nick You didn't specify a team rating. } } else { notice $nick You didn't specify a valid team size. notice $nick Valid team sizes: 2vs2, 3vs3. 5vs5, 2v2, 3v3. 5v5, 2, 3, and 5. } }
Arena point calculator Quakenet edition w/ PMs (DEPRECATED)
; Script by Dotted ; This script only works on networks with /cnotice support like Quakenet. ; This script is dual-licensed under the GPL, ; version 2 or (at your option) any later version. ; See http://www.gnu.org/licenses/gpl.txt for more details. on *:TEXT:!ap*:*: { if ($me isreg $chan) { if (!%ap_mode_error_msg) { msg $chan Due to a limitation to the Quakenet network, i will need voice to work! $iif($nick isop $chan,Please voice me $nick,$nick contact one of $chan $+ 's operators to get me voiced.) set -u600 %ap_mode_error_msg true } } else { var %ts = $2 var %x = $3 if ($istok(5versus5 3versus3 2versus2 5on5 3on3 2on2 5o5 3o3 2o2 3on3 2vs2 3vs3 5vs5 2v2 3v3 5v5 2 3 5,%ts,32)) { if (%x != $null) { var %tsp = $iif($istok(2versus2 2on2 2o2 2vs2 2v2 2,%ts,32),76,$iif($istok(3versus3 3on3 3o3 3vs3 3v3 3,%ts,32),88,$iif($istok(5versus5 5on5 5o5 5vs5 5v5 5,%ts,32),100,Error))) if (%x > 1500) && (%x <= 3901 ) { var %y = $int($calc($calc(1511.26 / (1 + 1639.28 * (2.71828 ^ (-0.00412 * %x )))) * %tsp / 100 )) if ($chan) { cnotice $nick $chan $nick $+ : $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points! } else { msg $nick $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points! close -m $nick } } elseif (%x > 0) && (%x <= 1500) { var %y = $int($calc($calc(0.22 * %x + 14) * %tsp / 100 )) if ($chan) { cnotice $nick $chan $nick $+ : $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points! } else { msg $nick $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points! close -m $nick } } else { if ($chan) { cnotice $nick $chan Team Rating out of bounds. } else { msg $nick Team Rating out of bounds. close -m $nick } } } } else { if ($chan) { cnotice $nick $chan You didn't specify a team rating. } else { msg $nick You didn't specify a team rating. close -m $nick } } } else { if ($chan) { cnotice $nick $chan You didn't specify a valid team size. cnotice $nick $chan Valid team sizes: 2versus2, 3versus3, 5versus5, 2on2, 3on3, 5on5, 2o2, 3o3, 5o5, 2vs2, 3vs3, 5vs5, 2v2, 3v3, 5v5, 2, 3, and 5. } else { msg $nick You didn't specify a valid team size. msg $nick Valid team sizes: 2versus2, 3versus3, 5versus5, 2on2, 3on3, 5on5, 2o2, 3o3, 5o5, 2vs2, 3vs3, 5vs5, 2v2, 3v3, 5v5, 2, 3, and 5. close -m $nick } } } }
Armory link creator
; Script by Dotted ; Only for use on QuakeNet ; This script is dual-licensed under the GPL, ; version 2 or (at your option) any later version. ; See http://www.gnu.org/licenses/gpl.txt for more details. on *:TEXT:!al*:*: { var %first = $remtok(%s,-1,32), %last = $gettok($1-,-1,32) if ($2 == EU) { if ($deltok($3-,-1,32) == $null) { cnotice $nick $chan You did not provide a realmname, please do so and try again | halt } elseif ($gettok($3-,-1,32) == $null) { cnotice $nick $chan You did not provide a nickname, please do so and try again | halt } tokenize 32 $1 $regsubex($2-6,/(\s|^)(.)(\S*)/g,\1$upper(\2) $+ $lower(\3)) $7- if ($chan) { cnotice $nick $chan $gettok($3-,-1,32) $+ ' $+ $iif($right($gettok($3-,-1,32),1) != s,s) Armory Profile: http://armory.wow-europe.com/character-sheet.xml?r= $+ $replace($deltok($3-,-1,32),$chr(32),$chr(43)) $+ &n= $+ $gettok($3-,-1,32) } else { msg $nick $gettok($3-,-1,32) $+ ' $+ $iif($right($gettok($3-,-1,32),1) != s,s) Armory Profile: http://armory.wow-europe.com/character-sheet.xml?r= $+ $replace($deltok($3-,-1,32),$chr(32),$chr(43)) $+ &n= $+ $gettok($3-,-1,32) } } elseif ($2 == US) { if ($deltok($3-,-1,32) == $null) { cnotice $nick $chan You did not provide a realmname, please so and try again | halt } elseif ($gettok($3-,-1,32) == $null) { cnotice $nick $chan You did not provide a nickname, please so and try again | halt } tokenize 32 $1 $regsubex($2-6,/(\s|^)(.)(\S*)/g,\1$upper(\2) $+ $lower(\3)) $7- if ($chan) { cnotice $nick $chan $gettok($3-,-1,32) $+ 's Armory Profile: http://armory.worldofwarcraft.com/character-sheet.xml?r= $+ $replace($deltok($3-,-1,32),$chr(32),$chr(37) $+ 20) $+ &n= $+ $gettok($3-,-1,32) } else { msg $nick cnotice $nick $chan $gettok($3-,-1,32) $+ 's Armory Profile: http://armory.worldofwarcraft.com/character-sheet.xml?r= $+ $replace($deltok($3-,-1,32),$chr(32),$chr(37) $+ 20) $+ &n= $+ $gettok($3-,-1,32) } } elseif ($2 != EU) || ($2 != US) || { if ($chan) { cnotice $nick $chan You did not provide a valid region name. cnotice $nick $chan Current valid regions: EU, US } else { msg $nick You did not provide a valid region name. msg $nick Current valid regions: EU, US } } else { if ($chan) { cnotice $nick $chan It seems an error occured, or you din't use the right parameters: cnotice $nick $chan Please use !al <continent> <realmname> <nickname> } else { msg $nick It seems an error occured, or you din't use the right parameters: msg $nick Please use !al <continent> <realmname> <nickname> } } }
Job queue grabber
alias wiki_jobqueue {
if ($sock(wiki_jobqueue)) { sockclose wiki_jobqueue }
sockopen wiki_jobqueue %jobqueue_host 80
}
alias wiki_jobqueue_jps {
if (%jobqueue_ttl) && (%jobqueue_host == www.wowwiki.com) {
var %jobqueue_time_difference = $calc(%jobqueue_time_new - %jobqueue_time_old)
var %jobqueue_difference = $calc(%jobqueue_old - %jobqueue_new)
var %jobqueue_jps = $calc(%jobqueue_difference / %jobqueue_time_difference)
var %jobqueue_ttl_var = $int($calc(%jobqueue_new / %jobqueue_jps))
set -u [ $+ [ %jobqueue_ttl_var ] ] %jobqueue_ttl %jobqueue_ttl_var
return doing $chr(126) $+ $round(%jobqueue_jps,2) jobs/s, done in aproxx. $duration(%jobqueue_ttl) $+ .
}
}
;this event is triggered on the moment the sockets is opened
on *:sockopen:wiki_jobqueue:{
;to tell the server which file you want to receive
sockwrite -n $sockname GET %jobqueue_address HTTP/1.1
sockwrite -n $sockname Host: %jobqueue_host
sockwrite -n $sockname User-Agent: [NewsBot]
sockwrite -n $sockname Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
sockwrite -n $sockname Accept-Language: en
sockwrite -n $sockname Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
sockwrite -n $sockname Keep-Alive: 300
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname Cookie: __utma=24527932.1806465100.1178387585.1178387585.1178387585.1; __utmb=24527932; __utmc=24527932; __utmz=24527932.1178387585.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
sockwrite -n $sockname Cache-Control: max-age=0
sockwrite -n $sockname $crlf
}
on *:sockread:wiki_jobqueue:{
if ($sockerr > 0) return
sockread %temp
if (job queue isin %temp) {
set %jobqueue_old %jobqueue_new
set %jobqueue_new $remove($gettok(%temp,5,60),b>,$chr(44))
set %jobqueue_time_old %jobqueue_time_new
set %jobqueue_time_new $ctime
msg %wiki_chan The %jobqueue_host job queue length is currently %jobqueue_new $wiki_jobqueue_jps
}
}
on *:TEXT:!jobqueue*:#: {
set %wiki_chan $chan
if ($2 != $null) {
set %jobqueue_host $gettok($remove($2,http://),1,47)
set %jobqueue_address $remove($gettok($2,2-,47),%jobqueue_host)
wiki_jobqueue %jobqueue_host %jobqueue_address
}
else {
set %jobqueue_address /Special:Statistics
set %jobqueue_host www.wowwiki.com
wiki_jobqueue %jobqueue_host %jobqueue_address
}
}