3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Show random quotegrab: if nick_search begins with "#", assume they meant to specify channel_search

This commit is contained in:
Pragmatic Software 2014-04-28 01:52:49 +00:00
parent 96c57d80e5
commit b35382109c
2 changed files with 12 additions and 6 deletions

View File

@ -428,6 +428,12 @@ sub show_random_quotegrab {
$channel_search = $possible_channel_search if not defined $channel_search;
$text_search = $possible_text_search if not defined $text_search;
if($nick_search =~ m/^#/) {
my $tmp = $channel_search;
$channel_search = $nick_search;
$nick_search = $tmp;
}
if(not defined $channel_search) {
$channel_search = $from;
}
@ -456,18 +462,18 @@ sub show_random_quotegrab {
my $result = "No quotes grabbed ";
if($nick_search ne '.*') {
$result .= "for $nick_search ";
$result .= "for nick $nick_search ";
}
if($channel_search ne '.*') {
$result .= "in $channel_search ";
$result .= "in channel $channel_search ";
}
if($text_search ne '.*') {
$result .= "matching '$text_search' ";
$result .= "matching text '$text_search' ";
}
return $result . "yet (use `rq <nick> <channel>` to specify the correct channel). Use `grab` to grab a quote.";;
return $result . "yet (usage: rq [nick regex] [-channel <channel regex>] [-text <text regex>]).";;
}
my $quotegrab = $quotes[int rand($#quotes + 1)];

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 555,
BUILD_DATE => "2014-04-26",
BUILD_REVISION => 556,
BUILD_DATE => "2014-04-27",
};
1;