From ba3f791d25c37337679c73c2e8ce3ab62bf56a84 Mon Sep 17 00:00:00 2001 From: timriker Date: Sat, 3 Jul 2004 20:35:55 +0000 Subject: [PATCH] metar git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@984 c11ca15a-4712-0410-83d8-924469b57eb5 --- blootbot/src/CommandStubs.pl | 3 +++ blootbot/src/Modules/Weather.pl | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) 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'; -- 2.39.5