ME
Hubot::Scripts::Bundle - optional scripts for hubot
=head1 SYNOPSIS
example F<hubot-scripts.json>
[
"redisBrain",
"help",
"ping",
"uptime",
"whisper"
illa;
{
$Hubot::Scripts::bugzilla::VERSION = '0.1.0';
}
use utf8;
use strict;
use warnings;
use JSON::XS;
my %PRIORITY_MAP = (
'---' => '☆☆☆☆☆',
Lowest => '★☆☆☆☆',
★★☆',
Highest => '★★★★★',
);
sub load {
my $client = JSONRPC->new( { url => $ENV{HUBOT_BZ_JSONPRC_URL} } );
my ( $class, $robot ) = @_;
$robot->hear(
qr/b(?:u
);
}
);
}
sub speak_bug {
my ( $msg, $body, $hdr ) = @_;
my $data = decode_json($body);
my $bug = @{ $data->{result}{bugs} ||= [] }[0];
$msg->send(
sprintf "#%s
pts::githubIssue;
$Hubot::Scripts::githubIssue::VERSION = '0.1.10';
use strict;
use warnings;
use JSON;
sub load {
my $github = githubot->new;
my ( $class, $robot ) = @_;
$robot->hear(
return if ( !$body || $hdr->{Status} !~ /^2/ );
my $data = decode_json($body);
$issue_title = $data->{title};
my $base_url = $EN
{
Accept => 'application/vnd.github.'
. $self->{apiVersion} . '+json',
'User-Agent' => "p5-GitHubot"
}
);
my $oauth_token = $self->{token}
ecode_utf8/;
use JSON;
sub load {
my ( $class, $robot ) = @_;
$robot->httpd->reg_cb(
'/hubot/jira' => sub {
my ( $httpd, $req ) = @_;
my $json = undef;
uery_param("room");
$req_room=~s/^%23/#/;
}
eval { $json = decode_json( $req->{content} ); };
if ($@) {
$req->respond(
'Bad Request',
{ content => 'text/json' },
"{ 'status': 'error', 'error': 'could not parse json' }"
]
);
}
use strict;
use warnings;
use Redis;
use JSON::XS;
use Encode qw/encode_utf8 decode_utf8/;
sub load {
my ( $class, $robot ) = @_;
my $coder = JSON::XS->new->convert_blessed;
my $redis =
cted to redis-server\n" if $ENV{DEBUG};
my $json = $redis->get('hubot:storage') || '{}';
$robot->brain->mergeData( decode_json( decode_utf8($json) ) );
$robot->brain->on(
'save',
ub {
my ( $e, $data ) = @_;
my $json = $coder->encode($data);
$redis->set( 'hubot:storage', encode_utf8($json) );
}
);
$robot->brain->on( 'close', s
bot::Scripts::eval;
{
$Hubot::Scripts::eval::VERSION = '0.1.0';
}
use strict;
use warnings;
use JSON::XS;
sub load {
my ( $class, $robot ) = @_;
$robot->hear(
qr/^eval:? on *$/i,
return if ( !$body || $hdr->{Status} !~ m/^2/ );
my $data = decode_json($body);
$msg->send( split /\n/,
$data->{stdout} || $d
return if ( !$body || $hdr->{Status} !~ m/^2/ );
my $data = decode_json($body);
$msg->send( split /\n/,
$data->{stdou
Hubot::Scripts::print;
$Hubot::Scripts::print::VERSION = '0.1.10';
use strict;
use warnings;
use JSON::XS;
sub load {
my ( $class, $robot ) = @_;
$robot->hear(
qr/^(?:print|say):? (.
return if ( !$body || $hdr->{Status} !~ m/^2/ );
my $data = decode_json($body);
$msg->send( split /\n/,
$data->{stdout} || $d
JSON;
sub load {
my ( $class, $robot ) = @_;
$robot->httpd->reg_cb(
'/hubot/say' => sub {
my ( $httpd, $req ) = @_;
my $json = undef;
eval { $json
= decode_json( $req->{content} ); };
if ($@) {
$req->respond(
[
400,
'Bad Request',
{ content => 'text/json' },
"{ 'status': 'error', 'error': 'could not parse json' }"
]
);
return;
}
googleImage;
{
$Hubot::Scripts::googleImage::VERSION = '0.1.0';
}
use strict;
use warnings;
use JSON::XS;
sub load {
my ( $class, $robot ) = @_;
$robot->respond(
qr/(image|img)( me)
uery($q)->get(
sub {
my ( $body, $hdr ) = @_;
my $images = decode_json($body);
$images = $images->{responseData}{results};
if (@$images) {