From 28739dabcc303676eadd0b4f2e37c48051fdecd0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 24 Jan 2010 23:40:45 -0600 Subject: forward along most other informational methods to plugins --- lib/Crawl/Bot.pm | 8 ++++++++ lib/Crawl/Bot/Plugin.pm | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Crawl/Bot.pm b/lib/Crawl/Bot.pm index 1f74762..111490d 100644 --- a/lib/Crawl/Bot.pm +++ b/lib/Crawl/Bot.pm @@ -57,6 +57,14 @@ sub tick { return $self->update_time; } +for my $meth (qw(said emoted chanjoin chanpart + nick_change kicked topic userquit)) { + __PACKAGE__->meta->add_method($meth => sub { + my $self = shift; + $_->$meth(@_) for @{ $self->plugins }; + }); +} + sub say_all { my $self = shift; my ($message) = @_; diff --git a/lib/Crawl/Bot/Plugin.pm b/lib/Crawl/Bot/Plugin.pm index c70e102..c95dd47 100644 --- a/lib/Crawl/Bot/Plugin.pm +++ b/lib/Crawl/Bot/Plugin.pm @@ -9,8 +9,16 @@ has bot => ( handles => [qw(say_all data_dir)], ); -# not all plugins require a tick method +# not all plugins require implementations here sub tick { } +sub said { } +sub emoted { } +sub chanjoin { } +sub chanpart { } +sub nick_change { } +sub kicked { } +sub topic { } +sub userquit { } __PACKAGE__->meta->make_immutable; no Moose; -- cgit v1.2.3-54-g00ecf