From 5906aa48ea29ad02c05ec63bd2cf6789b187b901 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Fri, 16 Nov 2018 14:51:42 +1300 Subject: Add Men->women/children plugin --- Plugin/Men.pm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Plugin/Men.pm diff --git a/Plugin/Men.pm b/Plugin/Men.pm new file mode 100644 index 0000000..1e8d71a --- /dev/null +++ b/Plugin/Men.pm @@ -0,0 +1,39 @@ +package Plugin::Men; + +use strict; +use warnings; + +my $config; +my $root_config; + +sub configure { + my $self = shift; + shift; # cmdref + shift; # run_command + shift; # module config + $root_config = shift; + + return $self; +} + +sub on_message { + my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_; + + if (ref($where) eq "ARRAY") { + $where = $where->[0]; + } + + if ($what =~ /(\b.+men.+\b)/) { + my ($w, $c, $target); + $w = $c = $target = $1; + $w =~ s/men/women/; + $c =~ s/men/children/; + return "not just the $target, but the $w and $c too"; + } + return; +} + +sub on_action { + on_message(@_); +} +1; -- cgit v1.1