]> git.donarmstrong.com Git - infobot.git/commitdiff
insult lives
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 21 Oct 2004 19:59:43 +0000 (19:59 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 21 Oct 2004 19:59:43 +0000 (19:59 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1029 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl
src/Modules/insult.pl

index 6b0d77880c147d99274f916a9aec1edc6f0526ce..d638cbf6212b1723791f5bdbf9dc3d585691585b 100644 (file)
@@ -184,8 +184,8 @@ sub parseCmdHook {
 &addCmdHook("extra", 'd?find', ('CODEREF' => 'Debian::DebianFind',
        'Forker' => 1, 'Identifier' => 'debian',
        'Cmdstats' => 'Debian Search', 'Help' => "find" ) );
-#&addCmdHook("extra", 'insult', ('CODEREF' => 'Insult::Insult',
-#      'Forker' => 1, 'Identifier' => 'insult', 'Help' => "insult" ) );
+&addCmdHook("extra", 'insult', ('CODEREF' => 'Insult::Insult',
+       'Forker' => 1, 'Identifier' => 'insult', 'Help' => "insult" ) );
 &addCmdHook("extra", 'kernel', ('CODEREF' => 'Kernel::Kernel',
        'Forker' => 1, 'Identifier' => 'kernel',
        'Cmdstats' => 'Kernel', 'NoArgs' => 1) );
index 79b85e9d1820d66bf297f1c2cfb2b03b232fad68..561e5b1f076eee6762c0710b92a3217696fcb61a 100644 (file)
@@ -1,7 +1,8 @@
 #
 # insult.pl: insult engine
-#      TODO: move this code out to a common file like I did with DNS.
-#           => use the command hooks system aswell
+#
+# 2004.10.21  Tim Riker <Tim@Rikers.org>
+# colorado server is dead. pull in the words and do it ourself
 #
 
 package Insult;
@@ -10,19 +11,84 @@ use strict;
 
 sub Insult {
     my ($insultwho) = @_;
-    return unless &::loadPerlModule("Net::Telnet");
-
-    my $t = new Net::Telnet(Timeout => 3);
-    $t->Net::Telnet::open(Host => "insulthost.colorado.edu", Port => "1695");
-    my $line = $t->Net::Telnet::getline(Timeout => 4);
-
-    $line = "No luck, $::who" unless (defined $line);
-
-    if ($insultwho ne $::who) {
-       $line =~ s/^\s*You are/$insultwho is/i;
+    my @adjs;
+    my @amts;
+    my @nouns;
+    print "Reading...\n";
+    while (<DATA>) {
+       chomp;
+       push(@adjs, split(" ", $1)) if /^adj\s*(.*)/;
+       push(@amts, split(" ", $1)) if /^amt\s*(.*)/;
+       push(@nouns, split(" ", $1)) if /^noun\s*(.*)/;
     }
+    grep(s/\|/ /g, @adjs);
+    grep(s/\|/ /g, @amts);
+    grep(s/\|/ /g, @nouns);
+    srand(); # fork seems to not change rand. force it here
+    my $adj = @adjs[rand(@adjs)];
+    my $n;
+    $n = 'n' if $adj =~ /^[aeiouih]/;
+    my $amt = @amts[rand(@amts)];
+    my $adj2 = @adjs[rand(@adjs)];
+    my $noun = @nouns[rand(@nouns)];
+    my $whois = "$insultwho is";
+    $whois = "You are" if ($insultwho eq $::who or $insultwho eq "me");
 
-    &::pSReply($line);
+    &::pSReply("$whois nothing but a$n $adj $amt of $adj2 $noun");
 }
 
 1;
+
+__DATA__
+#
+# configuration file for colorado insult server
+#
+# Use the '|' character to include a space in the middle of a noun, adjective
+# or amount (it'll get transmogrified into a space.  No, really!).
+#
+# Mon Mar 16 10:49:53 MST 1992 garnett added more colorful insults
+# Fri Dec  6 10:48:43 MST 1991 garnett
+#
+
+##
+# Adjectives
+##
+adj acidic antique contemptible culturally-unsound despicable evil fermented
+adj festering foul fulminating humid impure inept inferior industrial
+adj left-over low-quality malodorous off-color penguin-molesting
+adj petrified pointy-nosed salty sausage-snorfling tastless tempestuous
+adj tepid tofu-nibbling unintelligent unoriginal uninspiring weasel-smelling
+adj wretched spam-sucking egg-sucking decayed halfbaked infected squishy
+adj porous pickled coughed-up thick vapid hacked-up
+adj unmuzzled bawdy vain lumpish churlish fobbing rank craven puking
+adj jarring fly-bitten pox-marked fen-sucked spongy droning gleeking warped
+adj currish milk-livered surly mammering ill-borne beef-witted tickle-brained
+adj half-faced headless wayward rump-fed onion-eyed beslubbering villainous
+adj lewd-minded cockered full-gorged rude-snouted crook-pated pribbling
+adj dread-bolted fool-born puny fawning sheep-biting dankish goatish
+adj weather-bitten knotty-pated malt-wormy saucyspleened motley-mind
+adj it-fowling vassal-willed loggerheaded clapper-clawed frothy ruttish
+adj clouted common-kissing pignutted folly-fallen plume-plucked flap-mouthed
+adj swag-bellied dizzy-eyed gorbellied weedy reeky measled spur-galled mangled
+adj impertinent bootless toad-spotted hasty-witted horn-beat yeasty
+adj imp-bladdereddle-headed boil-brained tottering hedge-born hugger-muggered
+adj elf-skinned
+
+##
+# Amounts
+##
+amt accumulation bucket coagulation enema-bucketful gob half-mouthful
+amt heap mass mound petrification pile puddle stack thimbleful tongueful
+amt ooze quart bag plate ass-full assload
+
+##
+# Objects
+##
+noun bat|toenails bug|spit cat|hair chicken|piss dog|vomit dung
+noun fat-woman's|stomach-bile fish|heads guano gunk pond|scum rat|retch
+noun red|dye|number-9 Sun|IPC|manuals waffle-house|grits yoo-hoo
+noun dog|balls seagull|puke cat|bladders pus urine|samples
+noun squirrel|guts snake|assholes snake|bait buzzard|gizzards
+noun cat-hair-balls rat-farts pods armadillo|snouts entrails
+noun snake|snot eel|ooze slurpee-backwash toxic|waste Stimpy-drool
+noun poopy poop craptacular|carpet|droppings jizzum cold|sores anal|warts