mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 20:42:38 +01:00
Show random quotegrab: if nick_search begins with "#", assume they meant to specify channel_search
This commit is contained in:
parent
96c57d80e5
commit
b35382109c
@ -428,6 +428,12 @@ sub show_random_quotegrab {
|
|||||||
$channel_search = $possible_channel_search if not defined $channel_search;
|
$channel_search = $possible_channel_search if not defined $channel_search;
|
||||||
$text_search = $possible_text_search if not defined $text_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) {
|
if(not defined $channel_search) {
|
||||||
$channel_search = $from;
|
$channel_search = $from;
|
||||||
}
|
}
|
||||||
@ -456,18 +462,18 @@ sub show_random_quotegrab {
|
|||||||
my $result = "No quotes grabbed ";
|
my $result = "No quotes grabbed ";
|
||||||
|
|
||||||
if($nick_search ne '.*') {
|
if($nick_search ne '.*') {
|
||||||
$result .= "for $nick_search ";
|
$result .= "for nick $nick_search ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($channel_search ne '.*') {
|
if($channel_search ne '.*') {
|
||||||
$result .= "in $channel_search ";
|
$result .= "in channel $channel_search ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($text_search ne '.*') {
|
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)];
|
my $quotegrab = $quotes[int rand($#quotes + 1)];
|
||||||
|
@ -13,8 +13,8 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 555,
|
BUILD_REVISION => 556,
|
||||||
BUILD_DATE => "2014-04-26",
|
BUILD_DATE => "2014-04-27",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user