Colloquy::Bot::Simple - Simple robot interface for Colloquy


Colloquy-Bot-Simple documentation  | view source Contained in the Colloquy-Bot-Simple distribution.

Index


NAME

Top

Colloquy::Bot::Simple - Simple robot interface for Colloquy

SYNOPSIS

Top

 use Colloquy::Bot::Simple qw(daemonize);

 # Create a connection
 my $talker = Colloquy::Bot::Simple->new(
          host => '127.0.0.1',
          port => 1236,
          username => 'MyBot',
          password => 'topsecret',
     );

 # Daemonize in to the background
 daemonize("/tmp/MyBot.pid","quiet");

 # Execute callback on speech and "alarm" every 60 seconds
 $talker->listenLoop(\&event_callback, 60);

 # Tidy up and finish
 $talker->quit();
 exit;

 sub event_callback {
     my $talker = shift;
     my $event = @_ % 2 ? { alarm => 1 } : { @_ };

     if (exists $event->{alarm}) {
         print "Callback called as ALARM interrupt handler\n";
         # ... go check an RSS feed for new news items to inform
         #     your users about or something else nice maybe ...?

     } elsif (lc($event->{command}) eq 'hello') {
         $talker->whisper(
                 (exists $event->{list} ? $event->{list} : $event->{person}),
                 "Hi there $event->{person}"
             );

     } elsif ($event->{msgtype} eq 'TELL') {
         $talker->whisper($event->{person}, 'Pardon?');
     }

     # Return boolean false to continue the listenLoop
     return 0;
 }

DESCRIPTION

Top

A very simple robot interface to connect and interact with a Colloquy talker, based upon Chatbot::TalkerBot.

METHODS

Top

new

daemonize

listenLoop

say

whisper

quit

TODO

Top

Write some decent POD.

SEE ALSO

Top

Chatbot::TalkerBot, Parse::Colloquy::Bot, Bundle::Colloquy::BotBot2

VERSION

Top

$Id: Simple.pm 518 2006-05-29 11:32:23Z nicolaw $

AUTHOR

Top

Nicola Worthington <nicolaw@cpan.org>

http://perlgirl.org.uk

COPYRIGHT

Top


Colloquy-Bot-Simple documentation  | view source Contained in the Colloquy-Bot-Simple distribution.