HIROSE Masaaki > Bot-IKCBot-Pluggable-0.02 > Bot::IKCBot::Pluggable

Download:
Bot-IKCBot-Pluggable-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Bot::IKCBot::Pluggable - extended Bot::BasicBot::Pluggable for IKC

SYNOPSIS ^

run IKCBot server.

  use Bot::IKCBot::Pluggable;
  
  my $bot = Bot::IKCBot::Pluggable->new(
      ...
      ALIASNAME => 'ikchan',
      ikc_ip    => '127.0.0.1',
      ikc_port  => 1919,
     );
  $bot->load("Karma"); # you can load any
                       # Bot::BasicBot::Pluggable::Module::*
  $bot->run;

and you can talk to IKCBot by IKC. IKC specifier is ALIASNAME_IKC/PUBLISHED_STATE.

  use POE::Component::IKC::ClientLite;
  
  my $msg      = "hello!";
  my $channel  = "#test1919";
  my $bot_name = 'ikchan';
  
  my $ikc = POE::Component::IKC::ClientLite::create_ikc_client(
      ip      => '127.0.0.1',
      port    => 1919,
      name    => 'notify-irc',
     );
  $ikc->post($bot_name.'_IKC/say', { body => $msg, channel => $channel });

DESCRIPTION ^

Bot::IKCBot::Pluggable is IRC bot extends Bot::BasicBot::Pluggable for IKC support. So you can use all Bot::BasicBot::Pluggable::Module::*, Karma, Infobot, Title and so on.

In my case, for sending Nagios's alert message to IRC channel, run IKCBot and define Nagios's command that invokes notify script to send alert message to IKCBot.

If you want to add your own state of POE::Session, you can do it by changing hashref $Bot::IKCBot::Pluggable::STATE_TABLE and define handler function.

  use POE;
  use Bot::IKCBot::Pluggable;
  
  $Bot::IKCBot::Pluggable::STATE_TABLE->{important} = "say_2times";
  
  *Bot::IKCBot::Pluggable::say_2times = sub {
      my($self, $arg) = @_[ OBJECT, ARG0 ];
      $self->say($arg);
      $self->say($arg);
  };
  
  my $bot = Bot::IKCBot::Pluggable->new(
    ...
  );

Additionally, Bot::IKCBot::Pluggable has "notice" method and use "notice" instead of "say"(=privmsg) when replying.

SEE ALSO ^

Bot::BasicBot::Pluggable, Bot::BasicBot. POE::Component::IKC::Server, POE::Component::IKC::ClientLite,

AUTHOR ^

HIROSE Masaaki, <hirose31 at gmail.com>

REPOSITORY ^

http://github.com/hirose31/p5-bot-ikcbot-pluggable/tree/master

BUGS ^

Please report any bugs or feature requests to bug-bot-ikcbot-pluggable at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bot-IKCBot-Pluggable. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE ^

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

syntax highlighting: