NAME

POE::Component::IRC::Plugin::MegaHAL - A PoCo-IRC plugin which provides access to a MegaHAL conversation simulator.

SYNOPSIS

#!/usr/bin/env perl

use strict;
use warnings;
use POE;
use POE::Component::IRC::Plugin::AutoJoin;
use POE::Component::IRC::Plugin::Connector;
use POE::Component::IRC::Plugin::MegaHAL;
use POE::Component::IRC::State;

my $irc = POE::Component::IRC::State->spawn(
    nick     => 'Brainy',
    server   => 'irc.freenode.net',
);

my @channels = ('#other_chan', '#my_chan');

$irc->plugin_add('MegaHAL', POE::Component::IRC::Plugin::MegaHAL->new(Own_channel => '#my_chan'));
$irc->plugin_add('AutoJoin', POE::Component::IRC::Plugin::AutoJoin->new(Channels => \@channels));
$irc->plugin_add('Connector', POE::Component::IRC::Plugin::Connector->new());
$irc->yield('connect');

$poe_kernel->run();

DESCRIPTION

POE::Component::IRC::Plugin::MegaHAL is a POE::Component::IRC plugin. It provides "intelligence" through the use of POE::Component::AI::MegaHAL. It will respond when people either mention your nickname or address you.

This plugin requires the IRC component to be POE::Component::IRC::State or a subclass thereof. It also requires a POE::Component::IRC::Plugin::BotAddressed to be in the plugin pipeline. It will be added automatically if it is not present.

METHODS

new

Takes the following optional arguments:

'MegaHAL', a reference to an existing POE::Component::AI::MegaHAL object you have lying around. Useful if you want to use it with multiple IRC components. If this argument is not provided, the plugin will construct its own object.

'MegaHAL_args', a hash reference containing arguments to pass to the constructor of a new POE::Component::AI::MegaHAL object.

'Own_channel', a channel where it will reply to all messages, as well as greet everyone who joins. It will try to join this channel if the IRC component is not already on it. It will also part from it when the plugin is removed from the pipeline. Defaults to none.

'Flood_interval', default is 60 (seconds), which means that user X in channel Y has to wait that long before addressing the bot in the same channel if he doesn't want to be ignored. Setting this to 0 effectively turns off flood protection.

'Ignore', an array reference of IRC masks (e.g. "purl!*@*") to ignore.

'Method', how you want messages to be delivered. Valid options are 'notice' (the default) and 'privmsg'.

Returns a plugin object suitable for feeding to POE::Component::IRC's plugin_add() method.

brain

Takes no arguments. Returns the underlying POE::Component::AI::MegaHAL object being used by the plugin.

transplant

Replaces the brain with the supplied POE::Component::AI::MegaHAL instance. Shuts down the old brain if it was instantiated by the plugin itself.

AUTHOR

Hinrik Örn Sigurðsson, hinrik.sig@gmail.com

KUDOS

Those go to Chris BinGOs Williams and his friend GumbyBRAIN.