Hinrik Örn Sigurðsson > POE-Component-IRC-Plugin-MegaHAL-0.46 > POE::Component::IRC::Plugin::MegaHAL

Download:
POE-Component-IRC-Plugin-MegaHAL-0.46.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.46   Source  

NAME ^

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

SYNOPSIS ^

To quickly get an IRC bot with this plugin up and running, you can use App::Pocoirc:

 $ pocoirc -s irc.perl.org -j '#bots' -a MegaHAL

Or use it in your code:

 use POE::Component::IRC::Plugin::MegaHAL;
 
 $irc->plugin_add('MegaHAL', POE::Component::IRC::Plugin::MegaHAL->new(
     Own_channel    => '#bot_chan',
     English        => 1,
     Ignore_regexes => [ qr{^\s*\w+://\S+\s*$} ], # ignore URL-only lines
 ));

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 talk back when addressed by channel members (and possibly in other situations, see new). An example:

 --> megahal_bot joins #channel
 <Someone> oh hi there
 <Other> hello there
 <Someone> megahal_bot: hi
 <megahal_bot> oh hi there

It will occasionally send CTCP ACTIONS (/me) too, if the reply in question happens to be based on an earlier CTCP ACTION from someone.

All NOTICEs are ignored, so if your other bots only issue NOTICEs like they should, they will be ignored automatically.

Before using, you should read the documentation for POE::Component::AI::MegaHAL and by extension, AI::MegaHAL, so you have an idea of what to pass as the 'MegaHAL_args' parameter to new.

This plugin requires the IRC component to be POE::Component::IRC::State or a subclass thereof.

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.

'Channels', an array reference of channel names. If this is provided, the bot will only listen/respond in the specified channels, rather than all channels.

'Own_channel', a channel where it will reply to all messages, as well as greet everyone who joins. The plugin will take care of joining the channel. It will part from it when the plugin is removed from the pipeline. Defaults to none.

'Abuse_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 wants to get a reply. Setting this to 0 effectively turns off abuse protection.

'Talkative', when set to a true value, the bot will respond whenever someone mentions its name (in a PRIVMSG or CTCP ACTION (/me)). If false, it will only respond when addressed directly with a PRIVMSG. Default is false.

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

'Ignore_regexes', an array reference of regex objects. If a message matches any of them, it will be ignored. Handy for ignoring messages with URLs in them.

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

'English', when set to a true value, some English-language corrections will be applied to the bot's output. Currently it will capitalizes the word 'I' and make sure paragraphs end with '.' where appropriate. Defaults to false.

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.

syntax highlighting: