From a15624b52ef9d4e9d15517f1c91251bfc637a410 Mon Sep 17 00:00:00 2001 From: "Mathieu (matael) Gaborit" Date: Tue, 24 Jul 2012 20:51:52 +0200 Subject: [PATCH] Add a commande un quote group : add --- teuse.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/teuse.pl b/teuse.pl index 67eb68c..d173d73 100644 --- a/teuse.pl +++ b/teuse.pl @@ -119,6 +119,30 @@ sub said { channel => $a->{channel}, 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 { $self->say( who => $a->{who},