summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-01-24 23:40:45 -0600
committerJesse Luehrs <doy@tozt.net>2010-01-24 23:40:45 -0600
commit28739dabcc303676eadd0b4f2e37c48051fdecd0 (patch)
tree2e375be5da6afb357c0c4e8fdfa16d026b00fe9a
parente25e9a1d5a5c5fa281b7b6ae4b9b06001a7013bd (diff)
downloadcrawlbot-28739dabcc303676eadd0b4f2e37c48051fdecd0.tar.gz
crawlbot-28739dabcc303676eadd0b4f2e37c48051fdecd0.zip
forward along most other informational methods to plugins
-rw-r--r--lib/Crawl/Bot.pm8
-rw-r--r--lib/Crawl/Bot/Plugin.pm10
2 files changed, 17 insertions, 1 deletions
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;