Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ON *:TEXT:!*:#: {
- tokenize 32 $strip($1-,burci)
- if ($1 == !rank) {
- if (!$2-) { .msg $chan ( $+ $nick $+ ): Error, Not enough parameters, try again and enter the region! | return }
- if (!$3-) { .msg $chan ( $+ $nick $+ ): Error, Not enough parameters, try again and enter the summoner name! | return }
- rank $nick $chan $2 $urlencode($3-)
- }
- }
- alias rank {
- if ($me !ison $2) { return }
- if ($1 !ison $2) { return }
- if (!$1-) { return }
- var %u = https:// $+ $3 $+ .api.pvp.net/api/lol/ $+ $3 $+ /v1.4/summoner/by-name/ $+ $4 $+ ?api_key=API_CODE_HERE&nocache= $+ $ticks
- var %v = twc_ $+ $ticks
- JSONOpen -ud %v %u
- if (%JSONError) { .msg $2 ( $+ $1 $+ ): Error, There was an connection error to the website, please try again later! | goto end | return }
- var %n = $remove($urldecode($4),$chr(32))
- var %id = $json(%v,%n,id)
- var %name = $json(%v,%n,name)
- if (!%id) { .msg $2 ( $+ $1 $+ ): Error, The $qt($urldecode($4-)) nickname or the region that you have enter are not vaild! | goto end | return }
- var %uu = https:// $+ $3 $+ .api.pvp.net/api/lol/ $+ $3 $+ /v2.5/league/by-summoner/ $+ %id $+ /entry?api_key=API_CODE_HERE&nocache= $+ $ticks
- var %vv = tws_ $+ $ticks
- JSONOpen -ud %vv %uu
- if (%JSONError) { .msg $2 ( $+ $1 $+ ): Error, There was an connection and parsing error to the website, please try again later! | goto end | return }
- var %divi = $json(%vv,%id,0,entries,0,division)
- var %lp = $json(%vv,%id,0,entries,0,leaguePoints)
- var %tier = $json(%vv,%id,0,tier)
- if (!%divi) { .msg $2 ( $+ $1 $+ ): Error, There is NOT any information founded on the website for $qt(%name - %id) user Name/ID! | goto end | return }
- .msg $2 ( $+ $1 $+ ): $iif(%name,%name) is currently $upper($left($lower(%tier),1)) $+ $right($lower(%tier),-1) %divi and has $iif(!%lp,0 lp,%lp $+ LP)
- :end
- JSONClose %v
- JSONClose %vv
- }
- alias urlencode return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
- alias urldecode {
- var %r = $regsubex($replace($1, +, $chr(32)), /%([A-F\d]{2})/gi, $chr($base(\1, 16, 10)))
- var %rr = $utfdecode(%r)
- return %rr
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement