lugin::Parser::JSON;
$App::RoboBot::Plugin::Parser::JSON::VERSION = '4.004';
use v5.20;
use namespace::autoclean;
use Moose;
use MooseX::SetOnce;
use Data::Dumper;
use JSON;
use JSON::Path;
extend
App::RoboBot::Plugin';
=head1 parser.json
Exports a selection of functions for dealing with JSON structures.
=cut
has '+name' => (
default => 'Parser::JSON',
);
has '+description' => (
de
unctions for dealing with JSON structures.',
);
=head2 jq
=head3 Description
Performs a JSONPath query (similar in concept to XPath) against the given
JSON document. JSONPath is described at http:
use namespace::autoclean;
use Moose;
use MooseX::SetOnce;
use AnyEvent;
use Data::Dumper;
use JSON;
use Scalar::Util qw( blessed );
use App::RoboBot::Channel;
use App::RoboBot::Message;
use App::
ttps://example.com/api/tickets?"
(query-string { :status "open" :format "json" }))))))
=head2 delete-alarm
=head3 Description
Permanently removes the named alarm from the c
, { format => $format, pattern => $pattern });
}
}
$alarm{'exclusions'} = encode_json($alarm{'exclusions'} // []);
$res = $self->bot->config->db->do(q{
update alarms_alar
{
my ($self) = @_;
my $home = File::HomeDir->my_home();
my @exts = qw( conf yml yaml json xml ini );
my @bases = ("$home/.lispy/lispy.", "$home/.lispy.", "/etc/lispy.");
my @conf
.20;
use namespace::autoclean;
use Moose;
use MooseX::ClassAttribute;
use MooseX::SetOnce;
use JSON;
has 'id' => (
is => 'rw',
isa => 'Int',
traits => [qw( SetOnce )],
id => $res->{'id'},
name => $res->{'name'},
extradata => decode_json($res->{'extradata'}),
log_enabled => $res->{'log_enabled'},
network => (grep
n;
use Moose;
use MooseX::SetOnce;
use AnyEvent;
use AnyEvent::SlackRTM;
use Data::Dumper;
use JSON;
use LWP::Simple;
use App::RoboBot::Channel;
use App::RoboBot::Message;
use App::RoboBot::Nick;
ta
from channels
where network_id = ? and extradata @> ?
}, $self->id, encode_json({ slack_id => $slack_id }));
if ($res && $res->next) {
$channel = App::RoboBot::Chan
=> $res->{'id'},
name => $res->{'name'},
extradata => decode_json($res->{'extradata'}),
network => $self,
config => $self->bot->co
use Moose;
use MooseX::SetOnce;
use AnyEvent;
use AnyEvent::Mattermost;
use Data::Dumper;
use JSON;
use LWP::Simple;
use Try::Tiny;
use App::RoboBot::Channel;
use App::RoboBot::Nick;
extends 'Ap
msg->{'data'}{'post'} && length($msg->{'data'}{'post'}) > 0;
my $post = try {
decode_json($msg->{'data'}{'post'});
} catch {
return;
};
my $nick = App::RoboBot::Ni
4';
use v5.20;
use namespace::autoclean;
use Moose;
use MooseX::SetOnce;
use Data::Dumper;
use JSON;
use LWP::UserAgent;
use URI;
use XML::LibXML;
extends 'App::RoboBot::Plugin';
=head1 api.trans
my $json;
eval {
$json = decode_json($response->decoded_content);
};
return 0 if $@;
return 0 unless ref($json) eq 'HASH' && exists $json->{'access_token'} && $json->{'acce
ss_token'} =~ m{HMACSHA256};
$self->token($json->{'access_token'});
$self->last_authed(time() +0);
return 1;
}
sub translate_text {
my ($self, $message, $command, $rpl, $from, $to,
v::VERSION = '4.004';
use v5.20;
use namespace::autoclean;
use Moose;
use MooseX::SetOnce;
use JSON;
use Lingua::EN::Tagger;
use List::Util qw( shuffle );
extends 'App::RoboBot::Plugin';
=head1 f
structure_jsonb,
used_count, used_count::float / usemax.m * 100 * random()
from markov_sentence_forms,
usemax
where nick_id in ???
and jsonb_array_l
ength(structure_jsonb) between 5 and 20
and structure_jsonb \?& regexp_split_to_array(?, '[[:space:]]')
and structure like ?
order by 6 desc
limit 1
}, \@ni
toclean;
use Moose;
use MooseX::SetOnce;
use AnyEvent;
use Data::Dumper;
use HTTP::Request;
use JSON;
use LWP::UserAgent;
use URI;
use App::RoboBot::Channel;
use App::RoboBot::Response;
extends 'A
) as polled_at
}, $repo->{'repo_id'});
return unless $poll_t && $poll_t->next;
my ($json, @notices);
my $api_path = ['repos',$repo->{'owner_name'},$repo->{'repo_name'},'commits'];
) {
if (ref($json) eq 'ARRAY' && @{$json} > 0) {
my $oldest_commit;
my %commiters;
my @commits;
foreach my $commit (@{$json}) {
toclean;
use Moose;
use MooseX::SetOnce;
use AnyEvent;
use Data::Dumper;
use HTTP::Request;
use JSON;
use LWP::UserAgent;
use URI;
use App::RoboBot::Channel;
use App::RoboBot::Response;
extends 'A
rn unless $response->is_success;
my $json;
eval {
$json = decode_json($response->decoded_content);
};
return if $@;
return $json;
}
sub _run_watcher {
my ($self, $bo
t) = @_;
# TODO: Call base API path, get JSON
# TODO: Loop through keg list, compare each one's last_updated with the
# plugin's last_check attribute. Any with a new update should
Moose;
use MooseX::SetOnce;
use AnyEvent;
use Data::Dumper;
use DateTime;
use HTTP::Request;
use JSON;
use LWP::UserAgent;
use LWP::Protocol::https;
use URI;
use App::RoboBot::Channel;
use App::Robo
n/json' );
$req->header( 'Authorization' => sprintf('Token token=%s', $group->{'api_key'}) );
my $response = $self->ua->request($req);
return unless $response->is_success;
my $json;
eval {
$json = decode_json($response->decoded_content);
};
return if $@;
return $json;
}
sub now {
my ($self) = @_;
return DateTime->now->iso8601 . 'Z';
}
sub _vali
ot::Parser;
use Clone qw( clone );
use Data::Dumper;
use DateTime;
use DateTime::Format::Pg;
use JSON;
use Scalar::Util qw( blessed );
has 'bot' => (
is => 'ro',
isa => 'App::Robo
etwork => $network,
name => $res->{'name'},
arguments => decode_json($res->{'arguments'}),
definition => $res->{'definition'},
definer => A
macro_id = ?
}, {
name => $self->name,
arguments => encode_json($self->arguments),
definition => $self->definition,
is_locked => $self->