3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-27 13:12:42 +01:00

Add response messages for refresh command

This commit is contained in:
Pragmatic Software 2015-06-18 23:36:51 -07:00
parent 594b79d0f5
commit 497b713300

View File

@ -38,20 +38,29 @@ sub initialize {
sub refresh {
my ($self, $from, $nick, $user, $host, $arguments) = @_;
eval {
my $result = eval {
if (not $arguments) {
$self->{pbot}->{logger}->log("Refreshing all modified modules\n");
$self->{refresher}->refresh;
return "Refreshed all modified modules.\n";
} else {
$self->{pbot}->{logger}->log("Refreshing module $arguments\n");
if ($self->{refresher}->refresh_module_if_modified($arguments)) {
$self->{pbot}->{logger}->log("Refreshed module.\n");
return "Refreshed module.\n";
} else {
$self->{pbot}->{logger}->log("Module had no changes; not refreshed.\n");
return "Module had no changes; not refreshed.\n";
}
}
};
$self->{pbot}->{logger}->log("Error refreshing: $@\n") if $@;
if ($@) {
$self->{pbot}->{logger}->log("Error refreshing: $@\n");
return $@;
}
return $result;
}
1;