mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 19:22:40 +01:00
Plugins/Weather.pm and Plugins/Date.pm: Add more useful error messages for user-not-found
This commit is contained in:
parent
cd9561cee3
commit
309fb30656
@ -53,8 +53,8 @@ sub cmd_date {
|
|||||||
|
|
||||||
if (defined $user_override) {
|
if (defined $user_override) {
|
||||||
my $userdata = $self->{pbot}->{users}->{users}->get_data($user_override);
|
my $userdata = $self->{pbot}->{users}->{users}->get_data($user_override);
|
||||||
return "No such user account $user_override." if not defined $userdata;
|
return "No such user account $user_override. They may use the `my` command to create a user account and set their `timezone` user metadata." if not defined $userdata;
|
||||||
return "User account does not have `timezone` set." if not exists $userdata->{timezone};
|
return "User account does not have `timezone` set. They may use the `my` command to set their `timezone` user metadata." if not exists $userdata->{timezone};
|
||||||
$tz_override = $userdata->{timezone};
|
$tz_override = $userdata->{timezone};
|
||||||
} else {
|
} else {
|
||||||
$tz_override = $self->{pbot}->{users}->get_user_metadata($context->{from}, $context->{hostmask}, 'timezone') // '';
|
$tz_override = $self->{pbot}->{users}->get_user_metadata($context->{from}, $context->{hostmask}, 'timezone') // '';
|
||||||
|
@ -57,7 +57,7 @@ sub cmd_weather {
|
|||||||
my $location_override = $self->{pbot}->{users}->get_user_metadata($context->{from}, $hostmask, 'location') // '';
|
my $location_override = $self->{pbot}->{users}->get_user_metadata($context->{from}, $hostmask, 'location') // '';
|
||||||
$arguments = $location_override if not length $arguments;
|
$arguments = $location_override if not length $arguments;
|
||||||
|
|
||||||
if (defined $user_override and not length $location_override) { return "No location set or user account does not exist."; }
|
if (defined $user_override and not length $location_override) { return "No location set or user account does not exist. They may use the `my` command to set the `location` user metadata their user account."; }
|
||||||
|
|
||||||
if (not length $arguments) { return $usage; }
|
if (not length $arguments) { return $usage; }
|
||||||
return $self->get_weather($arguments);
|
return $self->get_weather($arguments);
|
||||||
|
Loading…
Reference in New Issue
Block a user