#!/usr/bin/perl use strict; use LWP::Simple; use Text::Wrap; use vars qw($VERSION %IRSSI); sub grouphug { my ($server, $data, $nick, $address) = @_; my ($target, $text) = split(/ :/, $data, 2); if($text eq "~grouphug") { my $content = get 'http://www.grouphug.us/random'; my $start = index($content, ''); my $length = index($content, '', $start) - $start; $content = substr($content, $start, $length); $content =~ s/(<.+?>|\t|\n)?//g; my @content = split("\n", wrap("", "", $content)); foreach(@content) { $server->command("msg $target $nick: $_"); } } } use Irssi; $VERSION = '1.00'; %IRSSI = ( authors => 'limetang', contact => 'lime@zybez.net', name => 'Grouphug Script', description => 'This script fetches a random confession from Grouphug.us.', license => 'Public domain', ); $Text::Wrap::columns = 431; Irssi::signal_add_last("event privmsg", "grouphug");