Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions lib/Synergy/Reactor/CatPic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,62 @@ sub _build_reactions ($self, @) {
return $reactions;
}

responder llama_pic => {
exclusive => 1,
targeted => 1,
help_titles => [ 'llama pic' ],
help => '*llama pic*: get a picture of a llama',
matcher => sub ($text, @) {
return unless $text =~ /\Allama\spic\z/i;
return [];
},
}, sub ($self, $event) {
$event->mark_handled;

my $http_future = $self->hub->http_client->GET(
"https://llama-as-a-service.vercel.app/llama_url"
);

return $http_future->on_done(sub($res) {

if ($res->code == 200) {
$event->reply($res->content);
return;
}

$event->reply("Error while retrieving llama pictures!")

});
};

responder llama_fax => {
exclusive => 1,
targeted => 1,
help_titles => [ 'llama fax' ],
help => '*llama fax*: get a fact about a llama',
matcher => sub ($text, @) {
return unless $text =~ /\Allama\s(facts?|fax)\z/i;
return [];
},
}, sub ($self, $event) {
$event->mark_handled;

my $http_future = $self->hub->http_client->GET(
"https://llama-as-a-service.vercel.app/llama_fax"
);

return $http_future->on_done(sub($res) {

if ($res->code == 200) {
$event->reply($res->content);
return;
}

$event->reply("Error while retrieving llama fax!")

});
};

responder cat_pic => {
exclusive => 1,
targeted => 1,
Expand Down