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