AnyEvent-SlackRTM
view release on metacpan or search on metacpan
lib/AnyEvent/SlackRTM.pm view on Meta::CPAN
L<rtm.connect|https://api.slack.com/methods/rtm.connect> method on the web API.
This returns some useful information, which is available here.
This will only contain useful information I<after> L</start> is called.
=head2 quiet
method quiet($quiet?) returns Bool
Normally, errors are sent to standard error. If this flag is set, that does not happen. It is recommended that you provide an error handler if you set the quiet flag.
=head2 on
method on($type, \&cb, ...)
This sets up a callback handler for the named message type. The available message types are available in the L<Slack Events|https://api.slack.com/events> documentation. Only one handler may be setup for each event. Setting a new handler with this met...
You can specify multiple type/callback pairs to make multiple registrations at once.
=head2 off
method off(@types)
This removes the handler for the named C<@types>.
=head2 send
method send(\%msg)
This sends the given message over the RTM socket. Slack requires that every message sent over this socket must have a unique ID set in the "id" key. You, however, do not need to worry about this as the ID will be set for you.
=head2 ping
method ping(\%msg)
This sends a ping message over the Slack RTM socket. You may add any paramters you like to C<%msg> and the return "pong" message will echo back those parameters.
=head2 said_hello
method said_hello() returns Bool
Returns true after the "hello" message has been received from the server.
=head2 finished
method finished() returns Bool
Returns true after the "finish" message has been received from the server (meaning the connection has been closed). If this is true, this object should be discarded.
=head2 close
method close()
This closes the WebSocket connection to the Slack RTM API.
=head1 CAVEATS
This is a low-level API. Therefore, this only aims to handle the basic message
handling. You must make sure that any messages you send to Slack are formatted
correctly. You must make sure any you receive are handled appropriately. Be sure
to read the Slack documentation basic message formatting, attachment formatting,
rate limits, etc.
1;
=head1 AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2022 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.
=cut
( run in 0.546 second using v1.01-cache-2.11-cpan-e1769b4cff6 )