Bot::BasicBot::Pluggable::Module::IMDB - give the url of a search on IMDB


Bot-BasicBot-Pluggable-Module-Search documentation Contained in the Bot-BasicBot-Pluggable-Module-Search distribution.

Index


Code Index:

NAME

Top

Bot::BasicBot::Pluggable::Module::IMDB - give the url of a search on IMDB

SYNOPSIS

Top

This is almost useless but it's provided as part of Infobot backwards compatability.

IRC USAGE

Top

    imdb (for ) <word> [ <date> ]

AUTHOR

Top

Simon Wistow, <simon@thegestalt.org>

COPYRIGHT

Top

SEE ALSO

Top


Bot-BasicBot-Pluggable-Module-Search documentation Contained in the Bot-BasicBot-Pluggable-Module-Search distribution.

package Bot::BasicBot::Pluggable::Module::IMDB;

use strict;
use Bot::BasicBot::Pluggable::Module; 
use base qw(Bot::BasicBot::Pluggable::Module);


sub said { 
    my ($self, $mess, $pri) = @_;

    my $body = $mess->{body}; 
    my $who  = $mess->{who};

    return unless ($pri == 2);

    return unless $body =~ s!^\s*imdb (for )?!!;


    my $date = "";
    my $url  = $body;
    if ($url =~ s/( \(\d+\))$//) { $date = $1; }

    $url =~ s/^(The|A|An|Les|Le|Das) (.*)/$2, $1/i;
    $url = "http://www.imdb.com/M/title-substring?title=$url$date&type=fuzzy";
    $url =~ s/ /+/g;
    return "$body can be found at $url";

}

sub help {
    return "Commands: 'imdb (for ) <word>'";
}

1;