Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a commande un quote group : add

  • Loading branch information...
commit a15624b52ef9d4e9d15517f1c91251bfc637a410 1 parent efde2d3
@Matael authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 teuse.pl
View
24 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},
Please sign in to comment.
Something went wrong with that request. Please try again.