User Control Panel
|
|
|
 |
Advertisements
|
 |
|
|
|
HELP US, HELP YOU!
|
| Author |
Message |
patrick Newbie

Joined: 17 Apr 2006 Posts: 42 Location: Arnhem, the Netherlands
      votes: 1
|
Posted: Sun May 07, 2006 6:24 pm Post subject: google search for andromeda bot |
|
|
This is my first command I made.
You need a google key (can be found here)
and you need http://api.google.com/GoogleSearch.wsdl (place it in your lib folder)
It is based on this made by Cer but this one is for the andromeda bot
| Code: | sub google {
my ($bot, $self, $user, $msg) = @_;
# They need a search query.
if (length $msg == 0) {
return "You must provide a query to search for.\n\n"
. "!google <search string>";
}
use SOAP::Lite;
my $google = SOAP::Lite->service ('file:./lib/GoogleSearch.wsdl');
my $query = $msg;
my $result = $google->doGoogleSearch("YOUR GOOGLE KEY HERE", $query, 0, 5, 'false', '', 'false', '', 'latin1', 'latin1');
my $reply;
foreach my $element (@{$result->{resultElements}}) {
$reply .= "$element->{title}\n"
. "$element->{URL}\n\n";
}
return "Google Search Results\n\n" . $reply;
}
{
Category => 'Utilities',
Usage => 'google <query>',
Description => 'Search with google.',
}; |
|
|
| Back to top |
|
 |
darkmonkey The Merovingian

Joined: 18 Apr 2004 Posts: 2557 Location: London, England
     votes: 7
|
Posted: Sun May 07, 2006 6:33 pm Post subject: |
|
|
Well done; keep up the good work! _________________ ~ Josh
[ Need bot hosting on a dedicated server? PM me. ] |
|
| Back to top |
|
 |
|
|