commit 2663f4a88905a632336b826779343e60765999d3
parent f9efd6b48a0e79f731e3bf966c4857744d0cd42a
Author: noodle <noodle@pastanoggin.com>
Date: Wed, 24 Sep 2025 15:27:34 +0000
change variable from "content" to "body" in GET responses to not shadow previos variables
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mata_bot.pl b/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);