From 27bb3bab95200aa4a99a8433a925abc1d7e51d7a Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 31 May 2021 11:36:29 -0700 Subject: [PATCH] Add `factoid > nick` redirection (only for factoids, not for commands) --- PBot/Factoids.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 6d47bdc5..ca4505aa 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -1094,6 +1094,17 @@ sub interpreter { $context->{arguments} = "" if not defined $context->{arguments}; + # factoid > nick redirection + if ($context->{arguments} =~ s/> ([_a-zA-Z0-9\[\]{}`\\-]+)$//) { + my $rcpt = $1; + if ($self->{pbot}->{nicklist}->is_present($context->{from}, $rcpt)) { + $context->{nickoverride} = $rcpt; + $context->{force_nickoverride} = 1; + } else { + $context->{arguments} .= "> $rcpt"; + } + } + # if no match found, attempt to call factoid from another channel if it exists there if (not defined $keyword) { my $string = "$original_keyword $context->{arguments}";