Adam
view release on metacpan or search on metacpan
lib/Moses.pm view on Meta::CPAN
);
}
sub poco_irc_options {
my ( $caller, %options ) = @_;
my $class = Moose::Meta::Class->initialize($caller);
$class->add_method( 'default_poco_irc_options' => sub { return \%options }
);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Moses - A framework for building IRC bots quickly and easily.
=head1 VERSION
version 1.003
=head1 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;
=head1 DESCRIPTION
Moses is declarative sugar for building IRC bots based on the L<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 L<POE> event loop via C<run()>, or an
L<IO::Async> mode via C<async()> that enables integration with
L<IO::Async>-based components such as L<Net::Async::MCP> or
L<Net::Async::HTTP>. The async mode requires L<IO::Async::Loop::POE>.
=head2 nickname
nickname 'sample-bot';
Set the nickname for the bot. Defaults to the current package name.
=head2 server
server 'irc.perl.org';
Set the IRC server for the bot to connect to.
=head2 port
port 6667;
Set the port for the bot's server. Defaults to C<6667>.
=head2 channels
channels '#bots', '#perl';
Supply a list of channels for the bot to join upon connecting.
=head2 plugins
plugins MyPlugin => 'MyBot::Plugin::Foo';
Extra L<POE::Component::IRC::Plugin> objects or class names to load into the bot.
=head2 username
username 'mybot';
The username to use for IRC connection.
=head2 password
password 'secret';
The server password to use for IRC connection.
=head2 flood
flood 1;
Disable flood protection. Defaults to false.
=head2 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 L<POE::Component::IRC::Plugin::PlugMan> interface.
( run in 0.999 second using v1.01-cache-2.11-cpan-39bf76dae61 )