Top

Canada Weather Bot


mIRC Code
+ 1 likes
Please Register to submit score.
Bookmark and Share
Average Score  7.7 (of 3 scores)
Date Added  Jan 16, 2009
Last Updated  Jan 16, 2009
Tags  bot  canada  socket  weather 

Introduction

This one will get the weather for locations in Canada using postcodes.


Usage: !caweather M3H 6A2

or

Usage: !caweather M3H6A2



Grab the Code

on *:text:!caweather*:#: {
  if ($len($2) == 6) { 
    set %caw2 $left($2,3) | set %caw3 $right($2,3) | set %cawchan $chan
    sockopen caweather www.accuweather.com 80
  }
  if ($len($2) == 3 && $len($3) == 3) { 
    set %caw2 $2 | set %caw3 $3 | set %cawchan $chan
    sockopen caweather www.accuweather.com 80
  }
}
on *:sockopen:caweather: { 
  sockwrite -n $sockname GET /canada-weather-forecast.asp?partner=accuweather&traveler=0&postalcode= $+ $+(%caw2,$chr(43),%caw3) HTTP/1.1 
  sockwrite -n $sockname Host: www.accuweather.com
  sockwrite -n $sockname Connection: close 
  sockwrite -n $sockname $crlf
}
on *:sockread:caweather: {
  if ($sockerr > 0) return 
  sockread %cawtemp 
  if ($sockbr == 0) return
  if (class="cityTitle"> isin %cawtemp) { set %cawloc $nohtml(%cawtemp) }
  if (_current_temps"> isin %cawtemp) { set %cawcurrent $replace($nohtml(%cawtemp),$(°),$chr(176)) }
  if (_current_rfval"> isin %cawtemp) { set %cawreal $replace($nohtml(%cawtemp),$(°),$chr(176)) }
  if (_curr_icon" isin %cawtemp) { set %cawcond1 $remove($gettok(%cawtemp,-1,61),$chr(34),$(/>)) } 
  if (_current_wxtext"> isin %cawtemp) { set %cawcond2 $nohtml(%cawtemp) }
  if (Humidity: isin %cawtemp) { set %cawhumidity $remove($nohtml(%cawtemp),Humidity:,$chr(9)) }
  if (Dew Point: isin %cawtemp) { set %cawdewpoint $remove($replace($nohtml(%cawtemp),$(°),$chr(176)),Dew Point:,$chr(9)) }
  if (Pressure: isin %cawtemp) { set %cawpressure $remove($nohtml(%cawtemp),Pressure:,$chr(9)) }
  if (Visibility: isin %cawtemp) { inc %t 1 | set %cawvisibility $+ %t $nohtml(%cawtemp) }
  if (quicklook_curr_head" isin %cawtemp) { set %cawcurtime $nohtml(%cawtemp) }
}
on *:sockclose:caweather: {
  if (!%cawloc) { msg %cawchan Please choose another postcode as that ones does not exists. }
  if (%cawloc) { 
    msg %cawchan Location: $remove(%cawloc ,$chr(9))
    msg %cawchan Current Condition: %cawcond1 and $remove(%cawcond2,$chr(9))
    msg %cawchan Currently: $remove(%cawcurrent,$chr(9)) Feels Like: $remove(%cawreal,$chr(9))
    msg %cawchan Humidity: %cawhumidity Dew Point: $remove(%cawdewpoint,$chr(32))
    msg %cawchan Pressure: %cawpressure Visibility: $remove(%cawvisibility1,Visibility:,$chr(32),$chr(9))
    msg %cawchan $remove(%cawcurtime,$chr(9)) in $remove(%cawloc,$chr(9))
    msg %cawchan http://www.accuweather.com/canada-weather-forecast.asp?partner=accuweather&traveler=0&postalcode= $+ $+(%caw2,$chr(43),%caw3)
  }
  unset %caw* %t*
}
alias -l nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}
 

Comments

  (4)  RSS
BabyJesus
Comments: 21
 
mIRC Snippet:  Canada Weather Bot
Posted on Jan 17, 2009 10:53 am
whoo i give it a 15 in canadian!. Well done scakk ol bboi.
Aucun50
Comments: 548
 
mIRC Snippet:  Canada Weather Bot
Posted on Jan 18, 2009 10:51 pm
/me give 10/10 for great work and use full.
Calliope
Comments: 13
 
mIRC Snippet:  Canada Weather Bot
Posted on Jan 19, 2009 10:32 pm
as a CANADIAN I wanna say thanks this is VERY useful for me. Not too floody either which is appreciated on the server I ghost these days. As always good work ;D /me gives a cookie to Scakk ;P (that must have been a warm day in North York lol )
pUtRaDeWa
Comments: 2
 
mIRC Snippet:  Canada Weather Bot
Posted on Jan 29, 2009 3:34 pm
bro please help me
tell the snippet for indonesia / asian weather bot

i try to make it self but its not working

the url of forecas in indonesia is
http://www.bmg.go.id/cuaca-indo1.bmg?Jenis=URL&IDS=3356283939755564582

please help me bro

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom