mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 11:42:35 +01:00
Improve recall
error message when no history is found
`recall` now shows all channels a nick was seen in if they weren't seen in the requested channel.
This commit is contained in:
parent
dfcef63e5e
commit
50fa9ff706
@ -308,6 +308,24 @@ sub recall_message {
|
||||
if(defined $account) {
|
||||
my $max_messages = $self->{database}->get_max_messages($account, $recall_channel);
|
||||
if($recall_history < 1 || $recall_history > $max_messages) {
|
||||
if ($max_messages == 0) {
|
||||
my @channels = $self->{database}->get_channels($account);
|
||||
my $result = "No messages for $recall_nick in $recall_channel; I have messages for them in ";
|
||||
my $comma = '';
|
||||
my $count = 0;
|
||||
foreach my $channel (sort @channels) {
|
||||
next if $channel !~ /^#/;
|
||||
$result .= "$comma$channel";
|
||||
$comma = ', ';
|
||||
$count++;
|
||||
}
|
||||
if ($count == 0) {
|
||||
return "I have no messages for $recall_nick.";
|
||||
} else {
|
||||
return "$result.";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return "Please choose a history between 1 and $max_messages";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user