rendered paste body
# grouphug -> IRC.
if ($message =~ /^\.gh.*/i) {
&status("collecting gh");
#my $grouphug = &grouphug::grouphug();
my @ghs;
my $ua = LWP::UserAgent->new;
my $dfg = $ua->get('http://grouphug.us/random/');
my $content = $dfg->content;
while ($content =~ /conf-id".*?>(\d+?)<\/a>.*?conf-text">\s*<p>\s*(.*?)<\/p>/igcs) {
my $n = $1;
my $quote = $2;
$quote =~ s/(<([^>]+)>)|(\xD\xA)|\t|\n//igs;
$quote = substr($quote, 0, 320);
$quote .= " ... ( more at http://grouphug.us/confessions/$n )";
push (@ghs,$quote);
}
&status("gh collected");
#return $ghs[int rand @ghs];
&say($ghs[int rand @ghs]);
&say($ghs[0]);
&say($ghs[1]);
&status(@ghs);
#&status($ghs[int rand @ghs]);
# return $grouphug;
# &say($grouphug);
}
# end grouphug