Skip to content

Commit

Permalink
Add a commande un quote group : add
Browse files Browse the repository at this point in the history
  • Loading branch information
matael committed Jul 24, 2012
1 parent efde2d3 commit a15624b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions teuse.pl
Expand Up @@ -119,6 +119,30 @@ sub said {
channel => $a->{channel}, channel => $a->{channel},
body => "La derniere en date est de $res->{author} avec \"$res->{quote}\"" body => "La derniere en date est de $res->{author} avec \"$res->{quote}\""
); );
} elsif ($1 =~ /\W*add\s([^\s]*)\s(.*)$/) {
# request to links.matael.org
my $ua = LWP::UserAgent->new();
my $author = $1;
my $quote = $url;

my $response = $ua->post("http://quotes.matael.org/",
[
author => $author,
quote => $quote
]
);
my $msg;
if ($response->is_error) {
$msg = "Arf... y'a un blem.... $master ? Un coup de main ?";
} else {
$msg = "Yes !!";
}

$self->say(
who => $a->{who},
channel => $a->{channel},
body => $msg
);
} else { } else {
$self->say( $self->say(
who => $a->{who}, who => $a->{who},
Expand Down

0 comments on commit a15624b

Please sign in to comment.