NAME
Bot::Backbone::Service::Role::ChatConsumer - Role for services that listen for chat messages
VERSION
version 0.161950
DESCRIPTION
Any service that needs to listen for chats and react to them will implement this role.
ATTRIBUTES
chat_name
service my_responder => (
service => '=My::Responder',
chat => 'jabber',
);
This attribute is named chat
during construction. It is used to look up the chat service set in "chat".
chat
This is the Bot::Backbone::Service::Role::Chat that this responder will receive messages from.
This must not be set directly and will be loaded lazily for you from the setting in "chat_name".
REQUIRED METHODS
receive_message
$consumer->receive_message($message);
Whenever the chat service receives a message, it will pass it on to each registered consumer by passing it to this method.
The method can do whatever it wants here and the return value of this method is ignored.
METHODS
send_message
send_reply
Be sure to use these versions of the methods. Otherwise any send policies you have set on this class will be ignored.
initialize
This adds a bit of code to run before the service's /initialize
. It loads the chat object from the bot and registers this consumer with that chat service.
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
COPYRIGHT AND LICENSE
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.