3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 11:59:43 +01:00

GoogleSearch: -n option can now appear anywhere

This commit is contained in:
Pragmatic Software 2021-08-28 09:13:08 -07:00
parent aaad36f99c
commit 2451eda70f
2 changed files with 3 additions and 4 deletions

View File

@ -39,8 +39,7 @@ sub cmd_googlesearch {
return "Usage: google [-n <number of results>] query\n" if not length $context->{arguments};
my $matches = 1;
$matches = $1 if $context->{arguments} =~ s/^-n\s+([0-9]+)\s*//;
$matches = $1 if $context->{arguments} =~ s/-n\s+([0-9]+)\s*//;
$matches = 10 if $matches > 10;
my $api_key = $self->{pbot}->{registry}->get_value('googlesearch', 'api_key'); # https://developers.google.com/custom-search/v1/overview
@ -101,7 +100,7 @@ sub cmd_googlesearch {
last if --$matches <= 0;
}
$output = join "\n-- ", @results;
$output .= join "\n-- ", @results;
return $output;
}

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4373,
BUILD_REVISION => 4374,
BUILD_DATE => "2021-08-28",
};