From 6a84735c5705f5f763c5f63b840d75a050c28d47 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 25 Jan 2010 00:43:16 -0600 Subject: also log messages sent by the bot --- lib/Crawl/Bot.pm | 1 + lib/Crawl/Bot/Plugin.pm | 1 + lib/Crawl/Bot/Plugin/Logging.pm | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/lib/Crawl/Bot.pm b/lib/Crawl/Bot.pm index 111490d..046e50f 100644 --- a/lib/Crawl/Bot.pm +++ b/lib/Crawl/Bot.pm @@ -47,6 +47,7 @@ before say => sub { my $self = shift; my %params = @_; warn "sending '$params{body}' to $params{channel}"; + $self->sent({%params, who => $self->nick}) for @{ $self->plugins }; }; sub tick { diff --git a/lib/Crawl/Bot/Plugin.pm b/lib/Crawl/Bot/Plugin.pm index c95dd47..185c209 100644 --- a/lib/Crawl/Bot/Plugin.pm +++ b/lib/Crawl/Bot/Plugin.pm @@ -19,6 +19,7 @@ sub nick_change { } sub kicked { } sub topic { } sub userquit { } +sub sent { } __PACKAGE__->meta->make_immutable; no Moose; diff --git a/lib/Crawl/Bot/Plugin/Logging.pm b/lib/Crawl/Bot/Plugin/Logging.pm index 7f58fd0..1382392 100644 --- a/lib/Crawl/Bot/Plugin/Logging.pm +++ b/lib/Crawl/Bot/Plugin/Logging.pm @@ -130,4 +130,12 @@ sub userquit { return; } +sub sent { + my $self = shift; + my ($args) = @_; + + $self->log_message("<$args->{who}> $args->{body}"); + return; +} + 1; -- cgit v1.2.3-54-g00ecf