mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
GoogleSearch: -n option can now appear anywhere
This commit is contained in:
parent
aaad36f99c
commit
2451eda70f
@ -39,8 +39,7 @@ sub cmd_googlesearch {
|
|||||||
return "Usage: google [-n <number of results>] query\n" if not length $context->{arguments};
|
return "Usage: google [-n <number of results>] query\n" if not length $context->{arguments};
|
||||||
|
|
||||||
my $matches = 1;
|
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;
|
$matches = 10 if $matches > 10;
|
||||||
|
|
||||||
my $api_key = $self->{pbot}->{registry}->get_value('googlesearch', 'api_key'); # https://developers.google.com/custom-search/v1/overview
|
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;
|
last if --$matches <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = join "\n-- ", @results;
|
$output .= join "\n-- ", @results;
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
|||||||
# These are set by the /misc/update_version script
|
# These are set by the /misc/update_version script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 4373,
|
BUILD_REVISION => 4374,
|
||||||
BUILD_DATE => "2021-08-28",
|
BUILD_DATE => "2021-08-28",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user