From 7e58f49fe7499f7ab55436a842f9872be5bc6fd4 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 15 Nov 2018 23:51:43 +1300 Subject: Add greeter plugin --- Plugin/Greet.pm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Plugin/Greet.pm (limited to 'Plugin') diff --git a/Plugin/Greet.pm b/Plugin/Greet.pm new file mode 100644 index 0000000..c281558 --- /dev/null +++ b/Plugin/Greet.pm @@ -0,0 +1,54 @@ +package Plugin::Greet; + +use strict; +use warnings; + +my $root_config; + +sub configure { + my $self = shift; + shift; # cmdref + shift; # run_command + shift; # module config + $root_config = shift; + + return $self; +} + +sub some { + my @choices = @_; + return $choices[rand(@choices)]; +} + +my @own_responses = ( + "It's me! I was the turkey all along!", + "Meeeeeee!", + "Hello, fellow humans", + "Hello", + "Hi", + "Morning all", + "Greetings, fellow earthlings", + "I'm back, baby!", + "I only came back to grab my keys", + "Has anyone seen my keys?", + "Anyone wanna listen to my podcast?" +); + +sub on_join { + my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_; + my $nick = (split /!/, $who)[0]; + if ($nick eq $root_config->{current_nick}) { + return some @own_responses; + } else { + return some( + "hi $nick", + "oh look, $nick is here", + "look who came crawling back", + "look at what the cat dragged in", + "$nick!!!!! guys!!!!!! $nick is here !!!!!!!!", + "weclome $nick", + "Welcome to $where->[0], $nick. Leave your sanity at the door", + "I feel sick"); + } +} +1; -- cgit v1.1