From d570dd7dd44b021b15e5e2bbd1421e8714c27b98 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 3 Sep 2015 20:50:07 -0700 Subject: [PATCH] Fix undefined variable warnings in `recall` --- PBot/MessageHistory.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PBot/MessageHistory.pm b/PBot/MessageHistory.pm index 6e5976ca..f7d850d2 100644 --- a/PBot/MessageHistory.pm +++ b/PBot/MessageHistory.pm @@ -246,9 +246,12 @@ sub recall_message { $recall_history = shift @$args if not defined $recall_history; $recall_channel = shift @$args if not defined $recall_channel; - $recall_count = 1 if $recall_count <= 0; + $recall_count = 1 if (not defined $recall_count) || ($recall_count <= 0); return "You may only select a count of up to 50 messages." if $recall_count > 50; + $recall_before = 0 if not defined $recall_before; + $recall_after = 0 if not defined $recall_after; + if ($recall_before + $recall_after > 200) { return "You may only select up to 200 lines of surrounding context."; } @@ -264,6 +267,8 @@ sub recall_message { $recall_channel = $temp; } + $recall_history = 1 if not defined $recall_history; + # swap history and channel if history looks like a channel and neither history or channel were specified if(not $channel_arg and not $history_arg and $recall_history =~ m/^#/) { my $temp = $recall_history;