Posted: Tue Jun 21, 2005 3:55 pm Post subject: A problem with a weather command
Hey, A while ago someone (forgotten who now) placed a weather command on here it worked world wide till weather.com change their page designs. Anyway i have edited it so it will work but it gives me a strange output (see pic below) does anyone have any code i could use to fix this, or replace it with or a way to make it work?
Code:
use LWP::Simple;
sub weather {
my ($bot,$self, $user, $name, $msg, $color) = @_;
my $field = {};
my $deg = decode_base64("wrA=");
$field->{query} = "Please wait while I get the information."
. "\nProvided by http://www.weather.com";
$field->{error} = "Sorry there's no state/zip code with '$msg' according to weather.com";
unless($msg) {
$self->sendMessage( "-error- The command is in the wrong format. it should be !weather <City Name>", Color => b23ce);
return;
}
$self->sendMessage($field->{query}, Color => c4285f);
$field->{XML} = get( "http://xoap.weather.com/search/search?where=$msg" );
if(!$field->{XML}) {
$self->sendMessage("Sorry the server seems to be down", Color => b23ce);
return;
}