aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2019-01-01 21:32:35 +1300
committerDavid Phillips <david@yeah.nah.nz>2019-01-01 21:32:35 +1300
commit83788d77a7dc389c9e72e3e5431da0a906421a72 (patch)
tree301616f99bdcd810629b99be9b4f4efd28f556f6
parentd0e6caaf6b95657a9a828fadf9fa0191686cba76 (diff)
downloadidalius-83788d77a7dc389c9e72e3e5431da0a906421a72.tar.xz
Timezone: Default to requester's nick if none given
-rw-r--r--Plugin/Timezone.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/Plugin/Timezone.pm b/Plugin/Timezone.pm
index 1e528ae..f10b3ca 100644
--- a/Plugin/Timezone.pm
+++ b/Plugin/Timezone.pm
@@ -27,15 +27,15 @@ sub time {
my $requester = (split /!/, $who)[0];
my @known_zones = (keys %{$config->{timezone}});
- return "Syntax: time [nick]" unless @arguments == 1;
+ return "Syntax: time [nick]" unless @arguments <= 1;
- my $nick = $arguments[0];
+ my $nick = $arguments[0] || $requester;
my ($case_nick) = grep {/^$nick$/i} @known_zones;
if ($case_nick) {
my $d = DateTime->now();
$d->set_time_zone($config->{timezone}->{$case_nick});
my $timestr = $d->strftime("%H:%M on %a %d %b, %Y (%Z)");
- return "$requester: $nick\'s clock reads $timestr";
+ return "$nick\'s clock reads $timestr";
} else {
return "$requester: I don't know what timezone $nick is in";
}