From 6d8fac71fb7359f6622dd2ac0c7fddb029fb7c11 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 10 Feb 2014 18:04:05 +0000 Subject: [PATCH] Improve output when no matching quotes found for `rq` command --- PBot/Quotegrabs.pm | 18 ++++++++++++++---- PBot/VERSION.pm | 4 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/PBot/Quotegrabs.pm b/PBot/Quotegrabs.pm index da0a3766..0f8729b3 100644 --- a/PBot/Quotegrabs.pm +++ b/PBot/Quotegrabs.pm @@ -448,11 +448,21 @@ sub show_random_quotegrab { } if($#quotes < 0) { - if($nick_search eq ".*") { - return "No quotes grabbed in $channel_search yet (use `rq ` to specify the correct channel). Use `grab` to grab a quote."; - } else { - return "No quotes grabbed for $nick_search in $channel_search yet (use `rq ` to specify the correct channel).. Use `grab` to grab a quote."; + my $result = "No quotes grabbed "; + + if($channel_search ne '.*') { + $result .= "in $channel_search "; } + + if($nick_search ne '.*') { + $result .= "for $nick_search "; + } + + if($text_search ne '.*') { + $result .= "matching '$text_search' "; + } + + return $result . "yet (use `rq ` to specify the correct channel).. Use `grab` to grab a quote.";; } my $quotegrab = $quotes[int rand($#quotes + 1)]; diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 968403d1..f3e507e4 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 479, - BUILD_DATE => "2014-02-04", + BUILD_REVISION => 480, + BUILD_DATE => "2014-02-10", }; 1;