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,
description => 'Creates an autoreplier with the given condition and response expressions.',
usage => '<name> (<condition expression>) (<response expression>)' },
'autoreply-list' => { method => 'autoreply_list',
description => 'Returns a list of the autoreplies that exist in the current channel.', },
'autoreply-delete' => { method => 'autoreply_delete',
description => 'Deletes the named autoreply for the current channel.',
( run in 1.153 second using v1.01-cache-2.11-cpan-39bf76dae61 )