diff --git a/lib/PBot/Core/Commands/MessageHistory.pm b/lib/PBot/Core/Commands/MessageHistory.pm index 880a5383..a2c47fb9 100644 --- a/lib/PBot/Core/Commands/MessageHistory.pm +++ b/lib/PBot/Core/Commands/MessageHistory.pm @@ -298,9 +298,13 @@ sub cmd_recall_message { $recall_count = 0; } - if ($recall_before + $recall_after > 100) { return "You may only select up to 100 lines of surrounding context."; } + if ($recall_before + $recall_after > 100) { + return "You may only select up to 100 lines of surrounding context."; + } - if ($recall_count > 1 and ($recall_before > 0 or $recall_after > 0)) { return "The `count` and `before/after` options cannot be used together."; } + if ($recall_count > 1 && ($recall_before > 0 || $recall_after > 0)) { + return "The `count` and `before/after` options cannot be used together."; + } # swap nick and channel if recall nick looks like channel and channel wasn't specified if (not $channel_arg and $recall_nick =~ m/^#/) { diff --git a/lib/PBot/Core/MessageHistory/Storage/SQLite.pm b/lib/PBot/Core/MessageHistory/Storage/SQLite.pm index 50d04374..db9e37ce 100644 --- a/lib/PBot/Core/MessageHistory/Storage/SQLite.pm +++ b/lib/PBot/Core/MessageHistory/Storage/SQLite.pm @@ -1021,8 +1021,7 @@ sub get_message_context { $search =~ s/\?/_/g; $messages_count = eval { - $sql .= 'AND msg LIKE ? ESCAPE "\" AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?'; - my $sth = $self->{dbh}->prepare($sql); + my $sth = $self->{dbh}->prepare($sql . ' AND msg LIKE ? ESCAPE "\" AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?'); my $param = 1; $sth->bind_param($param++, $message->{channel}); map { $sth->bind_param($param++, $_) } keys %seen_id; @@ -1038,8 +1037,7 @@ sub get_message_context { if (defined $before and $before > 0) { $messages_before = eval { - $sql .= ' AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?'; - my $sth = $self->{dbh}->prepare($sql); + my $sth = $self->{dbh}->prepare($sql . ' AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?'); my $param = 1; $sth->bind_param($param++, $message->{channel}); map { $sth->bind_param($param++, $_) } keys %seen_id; @@ -1054,8 +1052,7 @@ sub get_message_context { if (defined $after and $after > 0) { $messages_after = eval { - $sql .= ' AND timestamp > ? AND mode = 0 ORDER BY timestamp ASC LIMIT ?'; - my $sth = $self->{dbh}->prepare($sql); + my $sth = $self->{dbh}->prepare($sql . ' AND timestamp > ? AND mode = 0 ORDER BY timestamp ASC LIMIT ?'); my $param = 1; $sth->bind_param($param++, $message->{channel}); map { $sth->bind_param($param++, $_) } keys %seen_id; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 9c34f4be..d4aa2798 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 => 4381, - BUILD_DATE => "2021-09-07", + BUILD_REVISION => 4382, + BUILD_DATE => "2021-09-08", }; sub initialize {}