NAME

Moses - A framework for building IRC bots quickly and easily.

VERSION

version 1.002

SYNOPSIS

package SampleBot;
use Moses;
use namespace::autoclean;

server 'irc.perl.org';
nickname 'sample-bot';
channels '#bots';

has message => (
    isa     => 'Str',
    is      => 'rw',
    default => 'Hello',
);

event irc_bot_addressed => sub {
    my ( $self, $nickstr, $channel, $msg ) = @_[ OBJECT, ARG0, ARG1, ARG2 ];
    my ($nick) = split /!/, $nickstr;
    $self->privmsg( $channel => "$nick: ${ \$self->message }" );
};

# Run with POE (default)
__PACKAGE__->run unless caller;

# Or run with IO::Async (requires IO::Async::Loop::POE)
# __PACKAGE__->async unless caller;

DESCRIPTION

Moses is declarative sugar for building IRC bots based on the Adam IRC bot framework. Moses is designed to minimize the amount of work you have to do to make an IRC bot functional, and to make the process as declarative as possible.

Bots can run in two modes: the default POE event loop via run(), or an IO::Async mode via async() that enables integration with IO::Async-based components such as Net::Async::MCP or Net::Async::HTTP. The async mode requires IO::Async::Loop::POE.

nickname

nickname 'sample-bot';

Set the nickname for the bot. Defaults to the current package name.

server

server 'irc.perl.org';

Set the IRC server for the bot to connect to.

port

port 6667;

Set the port for the bot's server. Defaults to 6667.

channels

channels '#bots', '#perl';

Supply a list of channels for the bot to join upon connecting.

plugins

plugins MyPlugin => 'MyBot::Plugin::Foo';

Extra POE::Component::IRC::Plugin objects or class names to load into the bot.

username

username 'mybot';

The username to use for IRC connection.

password

password 'secret';

The server password to use for IRC connection.

flood

flood 1;

Disable flood protection. Defaults to false.

owner

owner 'nick!user@host';

The hostmask of the owner of the bot. The owner can control the bot's plugins through IRC using the POE::Component::IRC::Plugin::PlugMan interface.

poco_irc_args

poco_irc_args LocalAddr => '127.0.0.1';

Extra arguments to pass to the IRC component constructor.

poco_irc_options

poco_irc_options trace => 1;

Options to pass to the IRC component constructor.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/perigrin/adam-bot-framework/issues.

IRC

Join #ai on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHORS

  • Chris Prather <chris@prather.org>

  • Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Chris Prather, Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.