Bot::BasicBot::Op - simple irc bot subclass
# with all defaults my $bot = Bot::BasicBot::Op->new( channels => ["#bottest"] ); $bot->run();
# with all known options my $bot = Bot::BasicBot::Op->new(
server => "irc.example.com",
port => "6667",
channels => ["#bottest"],
nick => "basicbot",
alt_nicks => ["bbot", "simplebot"],
username => "bot",
name => "Yet Another Bot",
ignore_list => [qw(dipsy dadadodo laotse)],
charset => "utf-8", # charset the bot assumes the channel is using
ssl => 1, # 1 to use ssl secure connection 0 to not
); $bot->run();
Basic bot system designed to make it easy to do simple bots, optionally forking longer processes (like searches) concurrently in the background.
There are several examples of bots using Bot::BasicBot in the examples/ folder in the Bot::BasicBot tarball. If you installed Bot::BasicBot through CPAN, see http://jerakeen.org/programming/Bot-BasicBot for more docs and examples.
Bot::BasicBot::Op inherits Bot::BasicBot by adding administrative capabilities.
package Bot::BasicBot::Op; use strict; use warnings; use Bot::BasicBot; our $VERSION = 1.1; our $RECONNECT_TIMEOUT = 500;
Creates a new instance of the class. Name value pairs may be passed which will have the same effect as calling the method of that name with the value supplied. Returns a Bot::BasicBot::Op object, that you can call 'run' on later.
eg:
my $bot = Bot::BasicBot::Op->new( nick => 'superbot', channels => [ '#superheroes' ] );
Kick from channel $channel user $who for a reason $reason.
sub kick { my ($self, $channel, $who, $reason) = @_; $poe_kernel->post($self->{IRCNAME} => 'kick' => $channel => $who => $reason); }
Ban user $who from channel $channel.
sub ban { my ($self, $channel, $who) = @_; $poe_kernel->post($self->{IRCNAME} => 'ban' => $channel => $who); }
Bot::BasicBot by Tom Insam <tom@jerakeen.org>
Bot::BasicBot::Op by Marko Vihoma <lokki1977@gmail.com>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Thanks to my bro for suggesting trying Perl and O'Reilly Perl books too.
Bot::BasicBot::Op is based on POE, and really needs the latest version as of writing (0.22), since POE::Wheel::Run (used for forking) is still under development, and the interface recently changed. With earlier versions of POE, forking will not work if you have < 0.22. Sorry.
You also need POE::Component::IRC and Bot::BasicBot.
Don't call your bot "0".
POE, POE::Component::IRC and the Bot::BasicBot manpages
1;