1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/usr/bin/perl
=head1 NAME
namer - read out url titles in the channel
=cut
package Bot;
use base qw(Bot::BasicBot);
use warnings;
use strict;
use URI::Title qw( title );
use URI::Find::Simple qw( list_uris );
sub said {
my $self = shift;
my $message = shift;
my $body = $message->{body};
return unless my @urls = list_uris($message->{body});
$self->reply($message, title($_)) for (@urls);
}
Bot->new(
server => "irc.perl.org",
channels => [ '#jerakeen' ],
nick => 'namer',
)->run();
|