| 1 | package Exobrain::Measurement::Social; | ||
| 2 | |||
| 3 | use 5.010; | ||
| 4 | use Moose::Role; | ||
| 5 | use Method::Signatures; | ||
| 6 | |||
| 7 | # ABSTRACT: Base class for all social media events | ||
| 8 | our $VERSION = '1.08'; # VERSION | ||
| 9 | |||
| 10 | BEGIN { with 'Exobrain::Message'; } | ||
| 11 | |||
| 12 | payload from => ( isa => 'Str' ); | ||
| 13 | payload to => ( isa => 'ArrayRef[Str]', default => sub { [] } ); | ||
| 14 | payload from_me => ( isa => 'Bool', default => 0); | ||
| 15 | payload to_me => ( isa => 'Bool', default => 0); | ||
| 16 | payload tags => ( isa => 'ArrayRef[Str]', default => sub { [] } ); | ||
| 17 | payload text => ( isa => 'Str' ); | ||
| 18 | payload private => ( isa => 'Bool', default => 0); | ||
| 19 | |||
| 20 | # Platform and ID facilitate the sending of a response message without | ||
| 21 | # the full stack loaded for that particular message type. | ||
| 22 | payload platform => ( isa => 'Str' ); | ||
| 23 | payload id => ( isa => 'Str' ); | ||
| 24 | |||
| 25 | # This sends a 'response' intent, which presumably will be | ||
| 26 | # picked up by an agent that will translate such things into | ||
| 27 | # a more directed intent. | ||
| 28 | |||
| 29 | method respond(Str $text) { | ||
| 30 | $self->exobrain->intent('Response', | ||
| 31 | to => $self->from, | ||
| 32 | platform => $self->platform, | ||
| 33 | in_response_to => $self->id, | ||
| 34 | text => $text, | ||
| 35 | private => $self->private | ||
| 36 | ); | ||
| 37 | } | ||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | __END__ |