Bot::Backbone::Service::Role::Chat - Chat services must implement this role
version 0.141180
A chat service is one that sends and receives messages to other entities.
See Bot::Backbone::Service::ConsoleChat and Bot::Backbone::Service::JabberChat.
This is a list of Bot::Backbone::Service::Role::ChatConsumers that have registered to receive messages from this chat service. A chat consumer is registered using the register_chat_cnosumer method. A list_chat_consumers method is provided to list the registered consumers.
register_chat_cnosumer
list_chat_consumers
# Send a direct message $chat->send_message({ to => $to_username, text => 'blah blah blah', }); # Send a group message $chat->send_message({ group => $to_group, text => 'blah blah blah', });
Sends a message to a group or individual using this chat service. This is used when the message is not being made as a direct reply to a message received from the chat service.
If both group and to are passed, the preference should be to send to the group.
group
to
This role also provides a wrapper around your chat's implementation of send_message, which will apply the current service's send policy to the message. The most restrictive send policy encountered at any point will win.
send_message
A send policy may be explicitly provided by setting the send_policy setting in the parameters to a Bot::Backbone::SendPolicy object. Missing this parameter will result in an error. The send_policy_result may also be set to reflect the most restrictive send policy result encountered so far.
send_policy
send_policy_result
$chat->send_reply($message, \%options);
Given a message generated by this chat service, this should send a reply to the origin of the message, whether that be a group or individual or other entity.
The second argument is a hash reference of options, which is used to modify the reply further. See "send_message" for additional options and be aware that individual chat implementations may provide more options in addition to those shown here.
$chat->resend_message($message);
This should be called whenever a message is received from the chat service. This message willb e forwarded to all of the registered "chat_consumers".
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
This software is copyright (c) 2014 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, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Backbone
CPAN shell
perl -MCPAN -e shell install Bot::Backbone
For more information on module installation, please visit the detailed CPAN module installation guide.