From: timriker Date: Sat, 3 Jul 2004 20:35:55 +0000 (+0000) Subject: metar X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ba3f791d25c37337679c73c2e8ce3ab62bf56a84;p=infobot.git metar git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@984 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/CommandStubs.pl b/blootbot/src/CommandStubs.pl index 261da67..5bedd95 100644 --- a/blootbot/src/CommandStubs.pl +++ b/blootbot/src/CommandStubs.pl @@ -229,6 +229,9 @@ sub parseCmdHook { &addCmdHook("extra", 'weather', ('CODEREF' => 'Weather::Weather', 'Identifier' => 'weather', 'Help' => 'weather', 'Cmdstats' => 'weather', 'Forker' => 1) ); +&addCmdHook("extra", 'metar', ('CODEREF' => 'Weather::Metar', + 'Identifier' => 'weather', 'Help' => 'weather', + 'Cmdstats' => 'weather', 'Forker' => 1) ); &addCmdHook("extra", 'bzflist', ('CODEREF' => 'BZFlag::list', 'Identifier' => 'bzflag', 'Cmdstats' => 'BZFlag', 'Forker' => 1) ); diff --git a/blootbot/src/Modules/Weather.pl b/blootbot/src/Modules/Weather.pl index bf1c05e..9fef90e 100644 --- a/blootbot/src/Modules/Weather.pl +++ b/blootbot/src/Modules/Weather.pl @@ -21,12 +21,19 @@ BEGIN { sub Weather { my ($args) = @_; - &::performStrictReply(&queryText($args)); + &::performStrictReply(&queryText($args, 'weather')); + return; +} + +sub Metar { + my ($args) = @_; + &::performStrictReply(&queryText($args, 'metar')); return; } sub queryText { my ($station) = shift; + my ($wxmode) = shift; my $result; $station = uc($station); @@ -96,6 +103,10 @@ sub queryText { $min_temp = $1; if ($time) { + if ($wxmode eq 'metar' && defined($feat{'ob'})) { + return ("METAR " . $place . ": " . $feat{'ob'}); + } + $result = "$place; $id; last updated: $time"; foreach (sort keys %feat) { next if $_ eq 'ob';