package require http
package require json
bind pub - !gw2 pub:gw2Stats
proc pub:gw2Stats { nick uhost handle channel arg } {
set urlMatch "http://gw2stats.net/api/matches.json"
set urlRank "http://gw2stats.net/api/ratings.json"
set jsonMatch [http::data [http::geturl $urlMatch]]
set jsonRank [http::data [http::geturl $urlRank]]
set apiMatch [json::json2dict $jsonMatch]
set apiRank [json::json2dict $jsonRank]
namespace eval gw2Utils {
set tsvPath "tsvgw2/"
proc parsePairs { tsvName } {
set f [open [file nativename $gw2Utils::tsvPath$tsvName] r]
while { [eof $f] == 0 } {
set splitLine [split [gets $f] "\t"]
set pairMap([lindex $splitLine 0]) [lindex $splitLine 1]
}
return [array get pairMap]
}
proc insertCommas { num {sep ,} } {
while { [regsub {^([-+]?\d+)(\d\d\d)} $num "\\1$sep\\2" num] } {}
return $num
}
Replies to Re: Re: Untitled
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"text\/x-go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"mysql","xml":"xml","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","ecmascript":"javascript","groovy":"text\/x-groovy","haskell":"text\/x-haskell","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mysql":"mysql","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"plsql","properties":"text\/x-properties","scheme":"text\/x-scheme","vb":"text\/vbscript","vbnet":"text\/vbscript","verilog":"text\/x-verilog","yaml":"text\/x-yaml"}