From cdef9e5fe8df1a689ff579765e51483f8d2b76ec Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 4 Sep 2025 10:27:57 -0700 Subject: [PATCH] Core/IRC/Connection: dispatch pbot.public/pbot.caction events for bot messages --- lib/PBot/Core/IRC/Connection.pm | 12 ++++++++++++ lib/PBot/VERSION.pm | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/PBot/Core/IRC/Connection.pm b/lib/PBot/Core/IRC/Connection.pm index 3966e127..5dbf3c5a 100644 --- a/lib/PBot/Core/IRC/Connection.pm +++ b/lib/PBot/Core/IRC/Connection.pm @@ -1436,6 +1436,18 @@ sub sl_real { return unless defined $self->socket; + # dispatch pbot.public or pbot.action event + if ($line =~ m/^PRIVMSG (.*?) :(.*)$/) { + my $to = $1; + my $msg = $2; + + if ($msg =~ m/^\x01ACTION (.*)\x01$/) { + $self->{_pbot}->{event_dispatcher}->dispatch_event('pbot.caction', { to => $to, msg => $1 }); + } else { + $self->{_pbot}->{event_dispatcher}->dispatch_event('pbot.public', { to => $to, msg => $msg }); + } + } + if ($self->{_utf8}) { $line = encode('UTF-8', $line); } my $rv = eval { diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 73e32cfc..3e34c5a8 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,7 +25,7 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4886, + BUILD_REVISION => 4887, BUILD_DATE => "2025-09-04", };