3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01:00

Plugins/Weather.pm and Plugins/Date.pm: Add more useful error messages for user-not-found

This commit is contained in:
Pragmatic Software 2020-08-03 10:36:20 -07:00
parent cd9561cee3
commit 309fb30656
2 changed files with 3 additions and 3 deletions

View File

@ -53,8 +53,8 @@ sub cmd_date {
if (defined $user_override) {
my $userdata = $self->{pbot}->{users}->{users}->get_data($user_override);
return "No such user account $user_override." if not defined $userdata;
return "User account does not have `timezone` set." if not exists $userdata->{timezone};
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. They may use the `my` command to set their `timezone` user metadata." if not exists $userdata->{timezone};
$tz_override = $userdata->{timezone};
} else {
$tz_override = $self->{pbot}->{users}->get_user_metadata($context->{from}, $context->{hostmask}, 'timezone') // '';

View File

@ -57,7 +57,7 @@ sub cmd_weather {
my $location_override = $self->{pbot}->{users}->get_user_metadata($context->{from}, $hostmask, 'location') // '';
$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; }
return $self->get_weather($arguments);