Bot::Backbone::Service::Role::Chat - Chat services must implement this role


version 0.161950


A chat service is one that sends and receives messages to other entities.

See the following implementations:



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.



  # Send a direct message
      to          => $to_username,
      text        => 'blah blah blah',

  # Send a group 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.

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.

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.



  $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.



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 <>


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.