Skip to content

Commit

Permalink
Add an ACME::Hug class, like (the whimsical part of) moritz++'s hugme…
Browse files Browse the repository at this point in the history
… bot
  • Loading branch information
Geoffrey Broadwell committed Dec 30, 2013
1 parent 66bf7f8 commit 7ffdf6d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/Net/IRC/Modules/ACME.pm
Expand Up @@ -72,5 +72,23 @@ class Net::IRC::Modules::ACME::Rot13 does Net::IRC::CommandHandler {
}
}

#= Give someone a cuddle or hug
class Net::IRC::Modules::ACME::Hug does Net::IRC::CommandHandler {
#= Use 'hug <nick>' to send someone a hug, or 'hug me' to ask for one
method command_hug($ev, $match) {
# Original hug logic from https://github.com/moritz/hugme/blob/master/hugme.pl#L85
my $recipient = $match<params> eq 'me' ?? $ev.who !! $match<params>;
my $extra = '';
$extra ~= ' and blushes' if rand > .95;
$extra ~= "; {$ev.who}++" if rand > .99;
$ev.act("$match<command>s $recipient$extra");
}

#= Use 'cuddle <nick>' to send someone a cuddle, or 'cuddle me' to ask for one
method command_cuddle($ev, $match) {
self.command_hug($ev, $match);
}
}

# vim: ft=perl6 tabstop=4 shiftwidth=4

0 comments on commit 7ffdf6d

Please sign in to comment.