Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add a commande un quote group : add

  • Loading branch information...
commit a15624b52ef9d4e9d15517f1c91251bfc637a410 1 parent efde2d3
Mathieu G. authored July 24, 2012

Showing 1 changed file with 24 additions and 0 deletions. Show diff stats Hide diff stats

  1. 24  teuse.pl
24  teuse.pl
@@ -119,6 +119,30 @@ sub said {
119 119
 				channel => $a->{channel},
120 120
 				body => "La derniere en date est de $res->{author} avec \"$res->{quote}\""
121 121
 			);
  122
+		} elsif ($1 =~ /\W*add\s([^\s]*)\s(.*)$/) {
  123
+			# request to links.matael.org
  124
+			my $ua = LWP::UserAgent->new();
  125
+			my $author = $1;
  126
+			my $quote = $url;
  127
+
  128
+			my $response = $ua->post("http://quotes.matael.org/",
  129
+				[
  130
+					author => $author,
  131
+					quote => $quote
  132
+				]
  133
+			);
  134
+			my $msg;
  135
+			if ($response->is_error) {
  136
+				$msg = "Arf... y'a un blem.... $master ? Un coup de main ?";
  137
+			} else {
  138
+				$msg = "Yes !!";
  139
+			}
  140
+
  141
+			$self->say(
  142
+				who => $a->{who},
  143
+				channel => $a->{channel},
  144
+				body => $msg
  145
+			);
122 146
 		} else {
123 147
 			$self->say(
124 148
 				who => $a->{who},

0 notes on commit a15624b

Please sign in to comment.
Something went wrong with that request. Please try again.