1 ################################
3 ################################
5 # This module implements the same functionality as Insult.bm and
6 # Excuse.bm but using remote servers. Those servers are currently (and
7 # probably forever) down. This module is therefore mainly here for
8 # historical interest, and may be removed from future distributions.
9 # If you use, or need, this module, please let me know. - ian@hixie.ch
11 package BotModules::Rude;
14 @ISA = qw(BotModules);
21 '' => 'The Rude Module is... rude. Very rude! So rude!!!',
22 'insult' => 'Insults someone. Syntax: \'insult <who>\'',
23 'excuse' => 'Gives you an excuse for the system being down. Syntax: \'excuse\'',
27 # -- timeless was here --
28 # <timeless> Rude module is missing a jar jar quote ~how wude~
30 # RegisterConfig - Called when initialised, should call registerVariables
33 $self->SUPER::RegisterConfig(@_);
34 $self->registerVariables(
35 # [ name, save?, settable? ]
36 ['insultHost', 1, 1, 'insulthost.colorado.edu'],
37 ['insultPort', 1, 1, '1695'],
38 ['excuseHost', 1, 1, 'bofh.engr.wisc.edu'], # same host as bofh.jive.org
39 ['excusePort', 1, 1, '666'],
40 ['insultOverrides', 1, 1, { # overrides for the insults (keys must be lowercase)
41 'mozilla' => 'You are nothing but the best browser on the planet.',
42 'mozilla.org' => 'You are nothing but the best caretaker Mozilla ever had.',
43 'c++' => 'you are evil',
50 my ($event, $message) = @_;
51 if ($message =~ /^\s*(?:will\s+you\s+)?(?:insult|harass)\s+(\S+?)(?:[\s,.]+please)?[\s.?!]*$/osi) {
53 if (defined($self->{'insultOverrides'}->{lc $1})) {
54 $line = "$1: ".$self->{'insultOverrides'}->{lc $1};
57 my $t = new Net::Telnet (Timeout => 3);
58 $t->Net::Telnet::open(Host => $self->{'insultHost'}, Port => $self->{'insultPort'});
59 $line = "$1: ".$t->Net::Telnet::getline(Timeout => 4);
63 $self->say($event, $line);
65 $self->say($event, "$event->{'from'}: What have they ever done to you! Leave 'em alone!");
66 $self->debug("yikes, $self->{'insultHost'}:$self->{'insultPort'} is down!");
68 } elsif ($message =~ /^\s*(?:please\s+)?(?:can\s+i\s+have\s+an\s+|(?:(?:can|could)\s+you\s+)?give\s+me\s+an\s+)?excuse(?:[?,.!1\s]+please)?\s*[!?,.1]*\s*$/osi) {
71 my $t = new Net::Telnet (Timeout => 3);
72 $t->Net::Telnet::open(Host => $self->{'excuseHost'}, Port => $self->{'excusePort'});
73 # print "=== The BOFH-style Excuse Server --- Feel The Power!\n";
74 $t->Net::Telnet::getline(Timeout => 4);
75 # print "=== By Jeff Ballard <ballard\@cs.wisc.edu>\n";
76 $t->Net::Telnet::getline(Timeout => 4);
77 # print "=== See http://www.cs.wisc.edu/~ballard/bofh/ for more info.\n";
78 $t->Net::Telnet::getline(Timeout => 4);
79 # print "Your excuse is: $excuses[$j]";
80 $line = $t->Net::Telnet::getline(Timeout => 4);
83 # $line =~ s/^.*?Your excuse is: //gosi;
84 # $self->say($event, "$event->{'from'}: '$line'");
85 $self->say($event, "$line");
87 $self->say($event, "$event->{'from'}: Don't ask *me* for an excuse! Sheesh!");
88 $self->debug("yikes, $self->{'excuseHost'}:$self->{'excusePort'} is down!");
91 return $self->SUPER::Told(@_);
93 return 0; # we've dealt with it, no need to do anything else.