th the Slack RTM API
use AnyEvent;
use AnyEvent::WebSocket::Client 0.12;
use Carp;
use Furl;
use JSON;
use Try::Tiny;
our $START_URL = 'https://slack.com/api/rtm.connect';
sub new {
my ($class
$res = $furl->get($START_URL . '?token=' . $self->{token});
my $start = try {
decode_json($res->content);
}
catch {
my $status = $res->status;
my $message = $res->
ished"
if $self->{finished};
$msg->{id} = $self->{id}++;
$self->{conn}->send(encode_json($msg));
}
sub ping {
my ($self, $msg) = @_;
$self->send({
%{ $msg // {} },