| 1 |
=encoding utf8 |
| 2 |
|
| 3 |
=head1 NAME |
| 4 |
|
| 5 |
POE::Component::IRC::Cookbook::Hailo - A blabbering IRC bot |
| 6 |
|
| 7 |
=head1 SYNOPSIS |
| 8 |
|
| 9 |
This bot uses L<POE::Component::IRC::Plugin::Hailo|POE::Component::IRC::Plugin::Hailo> |
| 10 |
for most of its magic. As of yet, this recipe just contains a SYNOPSIS that is |
| 11 |
copied from its documentation. |
| 12 |
|
| 13 |
=head1 DESCRIPTION |
| 14 |
|
| 15 |
#!/usr/bin/env perl |
| 16 |
|
| 17 |
use strict; |
| 18 |
use warnings; |
| 19 |
use POE; |
| 20 |
use POE::Component::IRC::Plugin::AutoJoin; |
| 21 |
use POE::Component::IRC::Plugin::Connector; |
| 22 |
use POE::Component::IRC::Plugin::Hailo; |
| 23 |
use POE::Component::IRC::State; |
| 24 |
|
| 25 |
my $irc = POE::Component::IRC::State->spawn( |
| 26 |
nick => 'Brainy', |
| 27 |
server => 'irc.freenode.net', |
| 28 |
); |
| 29 |
|
| 30 |
my @channels = ('#public_chan', '#bot_chan'); |
| 31 |
|
| 32 |
$irc->plugin_add('AutoJoin', POE::Component::IRC::Plugin::AutoJoin->new(Channels => \@channels)); |
| 33 |
$irc->plugin_add('Connector', POE::Component::IRC::Plugin::Connector->new()); |
| 34 |
$irc->plugin_add('Hailo', POE::Component::IRC::Plugin::Hailo->new( |
| 35 |
Own_channel => '#bot_chan', |
| 36 |
Ignore_regexes => [ qr{\w+://\w} ], # ignore lines containing URLs |
| 37 |
Hailo_args => { |
| 38 |
brain_resource => 'brain.sqlite', |
| 39 |
}, |
| 40 |
)); |
| 41 |
|
| 42 |
$irc->yield('connect'); |
| 43 |
$poe_kernel->run(); |
| 44 |
|
| 45 |
=head1 AUTHOR |
| 46 |
|
| 47 |
Hinrik E<Ouml>rn SigurE<eth>sson, [email protected] |
| 48 |
|