From d8b19eff68077dddb0c512e283a7459cfdff65a0 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 30 Mar 2023 06:33:33 -0700 Subject: [PATCH] Plugin/Quotegrabs: `rq` now properly searches multi-grabs --- lib/PBot/Plugin/Quotegrabs/Storage/SQLite.pm | 7 ++++++- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/PBot/Plugin/Quotegrabs/Storage/SQLite.pm b/lib/PBot/Plugin/Quotegrabs/Storage/SQLite.pm index 31590e08..3fc78245 100644 --- a/lib/PBot/Plugin/Quotegrabs/Storage/SQLite.pm +++ b/lib/PBot/Plugin/Quotegrabs/Storage/SQLite.pm @@ -114,9 +114,14 @@ sub get_random_quotegrab { my $where = 'WHERE '; my $and = ''; + # multi-grabs have the nick separated by +'s so we must test for + # nick, nick+*, *+nick, and *+nick+* to match each of these cases if (defined $nick) { - $sql .= $where . 'nick LIKE ? '; + $sql .= $where . 'nick LIKE ? OR nick LIKE ? OR nick LIKE ? OR nick LIKE ?'; push @params, "$nick"; + push @params, "$nick+%"; + push @params, "%+$nick"; + push @params, "%+$nick+%"; $where = ''; $and = 'AND '; } diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index f3ccd20d..0aebf583 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4640, - BUILD_DATE => "2023-03-23", + BUILD_REVISION => 4641, + BUILD_DATE => "2023-03-30", }; sub initialize {}