App-RoboBot

 view release on metacpan or  search on metacpan

lib/App/RoboBot/Plugin/Bot/Autoreply.pm  view on Meta::CPAN

package App::RoboBot::Plugin::Bot::Autoreply;
$App::RoboBot::Plugin::Bot::Autoreply::VERSION = '4.004';
use v5.20;

use namespace::autoclean;

use Moose;
use MooseX::SetOnce;

use Data::Dumper;
use App::RoboBot::Parser;
use Scalar::Util qw( blessed );
use Try::Tiny;

extends 'App::RoboBot::Plugin';

=head1 bot.autoreply

Provides functions which allow the creation of rules to be evaluated against
incoming messages (and their metadata) and potentially trigger the execution of
expressions in response when those conditions are met.

=cut

has '+name' => (
    default => 'Bot::Autoreply',
);

has '+description' => (
    default => 'Provides functions which allow for conditionally evaluated expressions in response to incoming messages.',
);

has '+before_hook' => (
    default => 'autoreply_check',
);

has 'parser' => (
    is  => 'rw',
    isa => 'App::RoboBot::Parser',
);

has 'reply_cache' => (
    is      => 'rw',
    isa     => 'HashRef',
    default => sub { {} },
);

=head2 autoreply

=head3 Description

=head3 Usage

<name> (<condition expression>) (<response expression>)

=head3 Examples

    (autoreply "im-down" (match "qtiyd" (bot.messages/message)) (str "^"))

=cut

has '+commands' => (
    default => sub {{
        'autoreply' => { method          => 'autoreply_create',
                         preprocess_args => 0,



( run in 1.336 second using v1.01-cache-2.11-cpan-39bf76dae61 )