Commit Diff


commit - f9efd6b48a0e79f731e3bf966c4857744d0cd42a
commit + 2663f4a88905a632336b826779343e60765999d3
blob - 239b0cba1482d5614706bda6305625d5cc2cccde
blob + 037499a55a5b756cb1006229a9bb96e642bd5bf4
--- mata_bot.pl
+++ mata_bot.pl
@@ -51,7 +51,7 @@ sub respond_command {
 		my $nface = $2;
 		my $min = $ndice;
 		my $max = $ndice * $nface;
-		my $result = $min + int rand(1 + $max - $min);
+		my $result = randint($min, $max);
 		my $roll = 'd' . $nface;
 		$roll = $ndice . $roll if $ndice > 1;
 		$reply = "${sender_nick} rolled a ${roll} and got ${result}! ${MATA_HAPPY}";
@@ -162,8 +162,8 @@ sub respond {
 			$reply = "failed to get title of youtube video ${video_id} ${MATA_DEAD} (HTTP response empty!)";
 			return $message, $reply;
 		}
-		my $content = $response->{content};
-		if ($content =~ m,<span class="title"><a href="https://www\.youtube\.com/watch\?v=${video_id}" accesskey="0">([^<]+)</a>,i) {
+		my $body = $response->{content};
+		if ($body =~ m,<span class="title"><a href="https://www\.youtube\.com/watch\?v=${video_id}" accesskey="0">([^<]+)</a>,i) {
 			my $title = $1;
 			$title =~ tr/[\000\r\n]//d;
 			$title = trim($title);
@@ -199,8 +199,8 @@ sub respond {
 			$reply = "Empty HTTP response (GET ${url}) ${MATA_DEAD}";
 			return $message, $reply;
 		}
-		my $content = $response->{content};
-		if ($content =~ m,<title[^>]*>([^<]+)</title[^>]*>,i) {
+		my $body = $response->{content};
+		if ($body =~ m,<title[^>]*>([^<]+)</title[^>]*>,i) {
 			my $title = $1;
 			$title =~ tr/[\000\r\n]//d;
 			$title = trim($title);