mirror of
https://github.com/pragma-/pbot.git
synced 2025-05-03 13:17:33 +02:00
Plugins/Wttr: improve default output
This commit is contained in:
parent
317ed4fe9e
commit
8af9c3b9f8
@ -102,11 +102,11 @@ sub wttrcmd {
|
|||||||
delete $options{default};
|
delete $options{default};
|
||||||
}
|
}
|
||||||
|
|
||||||
return $self->get_wttr($arguments, %options);
|
return $self->get_wttr($arguments, sort keys %options);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_wttr {
|
sub get_wttr {
|
||||||
my ($self, $location, %options) = @_;
|
my ($self, $location, @options) = @_;
|
||||||
|
|
||||||
my %cache_opt = (
|
my %cache_opt = (
|
||||||
'namespace' => 'wttr',
|
'namespace' => 'wttr',
|
||||||
@ -158,7 +158,11 @@ sub get_wttr {
|
|||||||
$obsminute =~ s/ AM$//;
|
$obsminute =~ s/ AM$//;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $option (sort keys %options) {
|
if (@options == 1 and $options[0] eq 'default') {
|
||||||
|
push @options, 'chances';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $option (@options) {
|
||||||
given ($option) {
|
given ($option) {
|
||||||
when ('default') {
|
when ('default') {
|
||||||
$result .= "Currently: $c->{'weatherDesc'}->[0]->{'value'}: $c->{'temp_C'}C/$c->{'temp_F'}F; ";
|
$result .= "Currently: $c->{'weatherDesc'}->[0]->{'value'}: $c->{'temp_C'}C/$c->{'temp_F'}F; ";
|
||||||
@ -184,7 +188,13 @@ sub get_wttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sep eq '') { $result .= 'none'; }
|
if ($sep eq '') {
|
||||||
|
$result .= "Current conditions: $c->{'weatherDesc'}->[0]->{'value'}: $c->{'temp_C'}C/$c->{'temp_F'}F (Feels like $c->{'FeelsLikeC'}C/$c->{'FeelsLikeF'}F); ";
|
||||||
|
$result .= "Cloud cover: $c->{'cloudcover'}%; Visibility: $c->{'visibility'}km; ";
|
||||||
|
$result .= "Wind: $c->{'windspeedKmph'}kph/$c->{'windspeedMiles'}mph $c->{'winddirDegree'}°/$c->{'winddir16Point'}; ";
|
||||||
|
$result .= "Humidity: $c->{'humidity'}%; Precip: $c->{'precipMM'}mm; Pressure: $c->{'pressure'}hPa; UV Index: $c->{'uvIndex'}";
|
||||||
|
}
|
||||||
|
|
||||||
$result .= '; ';
|
$result .= '; ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user