| 1 | package Exobrain::Agent::Twitter::Response; | ||
| 2 | use Moose; | ||
| 3 | use Method::Signatures; | ||
| 4 | |||
| 5 | our $VERSION = '1.04'; # VERSION | ||
| 6 | # ABSTRACT: Spots respones bound for twitter, and sends them | ||
| 7 | |||
| 8 | with 'Exobrain::Agent::Twitter'; | ||
| 9 | with 'Exobrain::Agent::Run'; | ||
| 10 | |||
| 11 | method run() { | ||
| 12 | # Watches for twitter responses, and translates them. | ||
| 13 | |||
| 14 | $self->exobrain->watch_loop( | ||
| 15 | class => 'Intent::Response', | ||
| 16 | filter => sub { $_->platform eq $self->component }, | ||
| 17 | then => sub { | ||
| 18 | my $event = shift; | ||
| 19 | my $text = '@' . $event->to . ': ' . $event->text; | ||
| 20 | $event->exobrain->intent('Tweet', | ||
| 21 | to => $event->to, | ||
| 22 | in_response_to => $event->in_response_to, | ||
| 23 | tweet => $text, | ||
| 24 | # TODO - Handle a DM (private) flag if passed | ||
| 25 | ); | ||
| 26 | }, | ||
| 27 | ); | ||
| 28 | } | ||
| 29 | |||
| 30 | 1; | ||
| 31 | |||
| 32 | __END__ |