Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on $*:TEXT:/^[!@]heat/Si:#:{
- if (!$2) { notice $nick Usage: $1 <zip code> | halt }
- var %ticks $ticks
- sockopen $+(heatindex.,%ticks) www.weather.com 80
- sockmark $+(heatindex.,%ticks) $+($2,~,msg $chan)
- }
- on *:sockopen:heatindex*: {
- sockwrite -n $sockname GET $+(/weather/today/,$gettok($sock($sockname).mark,1,$asc(~))) HTTP/1.1
- sockwrite -n $sockname Host: www.weather.com
- sockwrite -n $sockname $crlf
- }
- on *:sockread:heatindex*: {
- if ($sockerr) { %return Socket error $+ $chr(44)) please try again | sockclose $sockname | halt }
- else {
- sockread %hi
- if (*feels-like-temperature* iswm %hi) {
- $gettok($sock($sockname).mark,2,$asc(~)) The heat index for $gettok($sock($sockname).mark,1,$asc(~)) is $replace($nohtml(%hi),°,°)
- sockclose $sockname
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement