File Coverage

blib/lib/Bot/BasicBot/Pluggable/Module/Abuse/YourMomma.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 8 0.0
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 12 33 36.3


line stmt bran cond sub pod time code
1             package Bot::BasicBot::Pluggable::Module::Abuse::YourMomma;
2 1     1   42218 use strict;
  1         3  
  1         47  
3 1     1   6 use base 'Bot::BasicBot::Pluggable::Module';
  1         2  
  1         759  
4 1     1   7 use vars qw($VERSION);
  1         6  
  1         329  
5              
6              
7             $VERSION = 0.02;
8              
9             =head1 NAME
10              
11             Bot::BasicBot::Pluggable::Module::Abuse::YourMomma - maturity is overrrated;
12              
13             =head1 DESCRIPTION
14              
15             Randomly throw in "your momma" jokes when someone says something the bot can
16             respond to with an incredibly witty and original "your momma"-type response.
17              
18             (No guarantee is provided as to the wittyness or originality of the jokes.)
19              
20             =head1 USAGE
21              
22             Load the module like you would any other L module.
23              
24             That's about it.
25              
26             =head1 FAQs
27              
28             =over 4
29              
30             =item Isn't this remarkably childish, silly and immature?
31              
32             Erm... yes.
33              
34             =item Shouldn't this be under the C namespace?
35              
36             Probably, except L modules go under the
37             C namespace, so, here it is.
38              
39             =item Were you bored when you wrote this?
40              
41             Whatever would make you think that?
42              
43             =item Who is the fat controller?
44              
45             Why, it's Ross, of course. *waves*
46              
47             =back
48              
49              
50              
51             =head1 AUTHOR
52              
53             David Precious C<< davidp@preshweb.co.uk >>
54              
55              
56             =head1 LICENSE AND COPYRIGHT
57              
58             Copyright 2011 David Precious.
59              
60             This program is free software; you can redistribute it and/or modify it
61             under the terms of either: the GNU General Public License as published
62             by the Free Software Foundation; or the Artistic License.
63              
64             See http://dev.perl.org/licenses/ for more information.
65              
66             =cut
67              
68             sub said {
69 0     0 0   my ($self,$mess,$pri) = @_;
70 0 0         return unless $pri == 2;
71              
72 0 0         if ($mess->{body} =~ m{
73             (is|it's) \s+
74             (ugly|dirty|smelly|filthy|nasty|horrible|minging)
75             }xmi) {
76 0           return random_response(
77             "So's your momma",
78             "So is your momma",
79             "So's yer mum",
80             "So's yer momma, bitch",
81             "Yeah, just like your momma",
82             "Yeah, just like your mum",
83             );
84             }
85              
86 0 0         if ($mess->{body} =~ m{
87             \b
88             (smells|sucks)
89             \b
90             }xmi) {
91 0           return random_response(
92             "Yeah, so does your momma",
93             "Yeah, just like your momma",
94             "Yeah, like your mum",
95             );
96             }
97             }
98              
99              
100             # Some of the time, return one of the possible responses at random. Other
101             # times, just return undef. We want to be unpredictable :)
102             sub random_response {
103 0     0 0   my @responses = shift;
104              
105 0 0         return if rand 10 < 3;
106 0           return $responses[rand @responses];
107             }
108              
109              
110             1;
111