view release on metacpan or search on metacpan
Amethyst/Brain/BarWench.pm view on Meta::CPAN
use strict;
use vars qw(@ISA);
use URI;
use Amethyst::Brain;
use Amethyst::Message;
@ISA = qw(Amethyst::Brain);
sub reply_to {
my $self = shift;
my $message = $self->SUPER::reply_to(@_);
# $message->channel('spam');
return $message;
}
sub init {
my $self = shift;
my %funcs = map { $_ => \&{"action_$_"} } qw(
help beer caffeine coffee beat pebkac sex npi
fuckup pissybeer base http hotornot jobs
Amethyst/Brain/Infobot/Module/BabyTime.pm view on Meta::CPAN
use Date::Format;
use Text::Soundex;
use Amethyst::Brain::Infobot::Module;
use Acme::Time::Baby; # (language => 'swedish chef');
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'BabyTime',
# Regex => qr/^(what is the? )?babytime/i,
Usage => '(what is the )? babytime in <language>',
Description => "Print the time for babies.",
@_
);
return bless $self, $class;
}
sub process {
Amethyst/Brain/Infobot/Module/Cool.pm view on Meta::CPAN
use strict;
use vars qw(@ISA);
use Amethyst::Message;
use Amethyst::Brain::Infobot;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Cool',
Regex => qr/^(?:neat|cool)(?:[!.])?$/i,
Usage => 'cool',
Description => "Be Cool",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Exchange.pm view on Meta::CPAN
use HTTP::Response;
use LWP::UserAgent; # For init
use Amethyst::Message;
use Amethyst::Brain::Infobot;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Exchange',
Regex => qr/^(?:ex)?change\s+(\d+)\s+(\w+)\s+(?:into|to|for)\s+(\w+)/x,
Usage => '(ex)?change 100 USD for DEM',
Description => "Convert currencies",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Excuse.pm view on Meta::CPAN
use Socket qw(AF_INET SOCK_STREAM);
use POE qw(Wheel::SocketFactory Wheel::ReadWrite
Filter::Line Driver::SysRW);
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Excuse',
Regex => qr/^(give me an? )?excuse$/i,
Usage => '((?:give me an)? excuse)',
Description => "Get an excuse from the excuse " .
"server.",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Fortune.pm view on Meta::CPAN
use Socket qw(AF_INET SOCK_STREAM);
use POE qw(Wheel::SocketFactory Wheel::ReadWrite
Filter::Line Driver::SysRW);
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Fortune',
Regex => qr/^(give me a? )?fortune$/i,
Usage => '((?:give me a)? fortune)',
Description => "Get a fortune from the fortune " .
"server.",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Google.pm view on Meta::CPAN
use WWW::Search;
use WWW::SearchResult;
use Amethyst::Message;
use Amethyst::Brain::Infobot;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Google',
Regex => qr/^(?:google|search)\s+for\s+(.*)$/i,
Usage => '(google|search) for .*',
Description => "Search Google",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Help.pm view on Meta::CPAN
use vars qw(@ISA);
use Amethyst::Message;
use Amethyst::Store;
use Amethyst::Brain::Infobot;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Help',
Regex => qr/^\s*help\b/i,
Usage => 'help [<module>]',
Description => "Help handler",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Insult.pm view on Meta::CPAN
use Socket qw(AF_INET SOCK_STREAM);
use POE qw(Wheel::SocketFactory Wheel::ReadWrite
Filter::Line Driver::SysRW);
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Insult',
Regex => qr/^insult (.*)$/i,
Usage => 'insult (.*)',
Description => "Insult someone.",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Karma.pm view on Meta::CPAN
use vars qw(@ISA);
use Amethyst::Message;
use Amethyst::Store;
use Amethyst::Brain::Infobot;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Karma',
Regex => qr/(?:karma|\+\+|--)/i,
Usage => '<foo>++|<foo>--|karma <foo>',
Description => "Karma handler",
@_
);
$self->{Store} = new Amethyst::Store(
Source => 'karma',
);
Amethyst/Brain/Infobot/Module/Math.pm view on Meta::CPAN
six => 6,
seven => 7,
eight => 8,
nine => 9,
ten => 10,
);
@DIGITS = ( 0 .. 9, 'A' .. 'Z' );
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Math',
Usage => 'Evaluates mathematical expressions',
Description => "Math handler",
@_
);
return bless $self, $class;
}
sub process {
Amethyst/Brain/Infobot/Module/Nslookup.pm view on Meta::CPAN
use POE;
use POE::Component::Client::DNS;
use Amethyst::Message;
use Amethyst::Brain::Infobot;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Nslookup',
Regex => qr/^(?:resolve|nslookup)\s+(.*)$/i,
Usage => 'resolve|nslookup .*',
Description => "Resolve names/IPs",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Purldoc.pm view on Meta::CPAN
use Amethyst::Brain::Infobot;
@ISA = qw(Amethyst::Brain::Infobot::Module);
my $any_bad;
sub new {
my $class = shift ;
return undef if $any_bad;
my $self = $class->SUPER::new(
Name => 'Purldoc',
Regex => qr/^p[ue]rldoc (.*)$/i,
Usage => 'purldoc (.*)',
Description => "Get related FAQ questions",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Statement.pm view on Meta::CPAN
$RE_IGNORE = "if|this|that|there|so|some|someone" .
"|he|she|we|it|they|you|i" .
"|$RE_QUESTION";
$RE_PREAMBLE = "think|thinks|note|notes|said|say|says|that";
$RE_RMKPREFIX = "but|and|or|btw|actually|well"; # |a|the
$RE_RMKSUFFIX = "really|actually";
$RE_RMVSUFFIX = "too|also|as well";
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Statement',
# Regex => qr/(?:karma|\+\+|--)/i,
Usage => 'Make a statement. Ask a question.',
Description => "Statement handler",
@_
);
die "No FactoidWrite store in Infobot config"
unless $self->{Infobot}->{FactoidWrite};
Amethyst/Brain/Infobot/Module/Time.pm view on Meta::CPAN
use Date::Format;
use Text::Soundex;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
$ZONEDIR = "/usr/share/zoneinfo/";
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Time',
# Regex => qr/^(what is the? )?time/i,
Usage => '(what is the )? time in <zone>',
Description => "Print the time in a particular " .
"place.",
@_
);
$ZONEDIR = $self->{Zonedir} if exists $self->{Zonedir};
Amethyst/Brain/Infobot/Module/Zappa.pm view on Meta::CPAN
use strict;
use vars qw(@ISA);
use Amethyst::Message;
use Amethyst::Brain::Infobot;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Zappa',
Regex => qr/^(be zappa)$/i,
Usage => 'be zappa',
Description => "gives you a random quote from " .
"Frank Zappa",
@_
);
return bless $self, $class;
}
Amethyst/Brain/Infobot/Module/Zippy.pm view on Meta::CPAN
use strict;
use vars qw(@ISA);
use Amethyst::Message;
use Amethyst::Brain::Infobot;
use Amethyst::Brain::Infobot::Module;
@ISA = qw(Amethyst::Brain::Infobot::Module);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Zippy',
Regex => qr/^(be zippy|yow)$/i,
Usage => 'be zippy|yow',
Description => "gives you a random quote from " .
"Zippy the Pinhead",
@_
);
return bless $self, $class;
}