Bot::Backbone::Service::IRChat - Connect and chat with an IRC server
version 0.160630
service irc_chat => ( service => 'IRChat', nick => 'fancybot', server => 'irc.perl.org', );
Can be used to connect to and chat on Internet Relay Chat servers. Will join channels on the server and communicate with groups that way sa well. It can also speak via private messages.
This is the nickname the bot will take.
This is the hostname of the IRC server to connect.
This is the internal POE::Component::IRC::State object used to communicate with the server. It is automatically built using the other settings given to this service.
This is a boolean flag that is set to true once the IRC connection is established and the server has started sending messages.
This is used to keep track of the channels that the service has been asked to join. These channels will be joined once "session_ready" is set to true.
This starts up the POE session required to connect this service to the event loop.
When the POE session is setup, this initiates the connection to the IRC server.
This handler is called once the server has started sending messages over the connection and is ready to receive. At this point, "session_ready" will return true and any channels that need to be joined will be joined.
This handler is called whenever a privmsg is sent directly to the bot. It passes the message on to the dispatcher and such.
This handler is called whenever a privmsg is sent to a channel that bot has joined. It passes the message on to the dispatcher and such.
$chat->join_group({ group => 'example' });
Joins the group pass to the group option. On IRC, the nickname option is ignored.
group
nickname
my $bool = $self->is_to_me($user, \$text);
Given the user that identifies the bot in a group chat and text that was just sent to the chat, this detects if the message was directed at the bot. Normally, this includes messages that start with the following:
nick: ... nick, ... nick- ...
It also includes suffix references like this:
..., nick. ..., nick
and infix references like this:
..., nick, ...
If you want something different, you may subclass service and override this method.
Note that the text is sent as a reference and can be modified, usually to remove the nick from the message so the bot does not have to worry about that.
$chat->send_message( to => 'bob', text => 'hi' ); $chat->send_message( group => 'example, text => 'hi' );
Call to send a message to the nick, via to, or channel, via group, named.
to
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
This software is copyright (c) 2016 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Bot::Backbone::Service::IRChat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Backbone::Service::IRChat
CPAN shell
perl -MCPAN -e shell install Bot::Backbone::Service::IRChat
For more information on module installation, please visit the detailed CPAN module installation guide.