]> git.donarmstrong.com Git - infobot.git/blob - src/Modules/insult.pl
ws
[infobot.git] / src / Modules / insult.pl
1 #
2 # insult.pl: insult engine
3 #      TODO: move this code out to a common file like I did with DNS.
4 #            => use the command hooks system aswell
5 #
6
7 package Insult;
8
9 use strict;
10
11 sub Insult {
12     my ($insultwho) = @_;
13     return unless &::loadPerlModule("Net::Telnet");
14
15     my $t = new Net::Telnet(Timeout => 3);
16     $t->Net::Telnet::open(Host => "insulthost.colorado.edu", Port => "1695");
17     my $line = $t->Net::Telnet::getline(Timeout => 4);
18
19     $line = "No luck, $::who" unless (defined $line);
20
21     if ($insultwho ne $::who) {
22         $line =~ s/^\s*You are/$insultwho is/i;
23     }
24
25     &::pSReply($line);
26 }
27
28 1;