From aa749860c0b72758c743fc598ed8a6ee387b634c Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 25 Oct 2015 04:01:45 -0700 Subject: [PATCH] Look for module in global channel before falling back to local channel --- PBot/FactoidModuleLauncher.pm | 3 +-- PBot/Factoids.pm | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/PBot/FactoidModuleLauncher.pm b/PBot/FactoidModuleLauncher.pm index dc349ba0..9d189b07 100644 --- a/PBot/FactoidModuleLauncher.pm +++ b/PBot/FactoidModuleLauncher.pm @@ -44,8 +44,7 @@ sub execute_module { $arguments = "" if not defined $arguments; - my @factoids = $self->{pbot}->{factoids}->find_factoid($from, $keyword); - + my @factoids = $self->{pbot}->{factoids}->find_factoid($from, $keyword, undef, 2, 2); if(not @factoids or not $factoids[0]) { $self->{pbot}->{interpreter}->handle_result($from, $nick, $user, $host, $command, "$keyword $arguments", "/msg $nick Failed to find module for '$keyword' in channel $from\n", 1, 0); diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 01e5c334..460af900 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -291,7 +291,7 @@ sub find_factoid { goto NEXT_DEPTH; } - if ($exact_channel == 1) { + if (defined $exact_channel && $exact_channel == 1) { return ($channel, $trigger); } else { push @results, [$channel, $trigger];