From 9c8687da1c67a7fb75685b869b6d4e2b609628b9 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Thu, 17 Mar 2011 21:23:45 -0600 Subject: [PATCH] Added a LOLCAT module for translating English to LOLCAT. --- NEWS | 1 + doc/CHANGELOG | 1 + modules/LOLCAT.pm | 100 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 modules/LOLCAT.pm diff --git a/NEWS b/NEWS index 3fc67bd..fbe53d8 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ In this alpha8 release, we have added: * Support for system-wide installs. (/usr or /usr/local) * The `wizard` utility, for creating local Auto config directories. * EightBall rewritten to be much nicer. +* A module to translate English into LOLCAT (LOLCAT). Bug fixes: diff --git a/doc/CHANGELOG b/doc/CHANGELOG index b5e45e0..871fab0 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Added a LOLCAT module for translating English to LOLCAT. * EightBall module rewritten. * Fixed a bug in LinkTitle that caused multi-line 's to display wrong. diff --git a/modules/LOLCAT.pm b/modules/LOLCAT.pm new file mode 100644 index 0000000..aa9c9cc --- /dev/null +++ b/modules/LOLCAT.pm @@ -0,0 +1,100 @@ +# Module: LOLCAT. See below for documentation. +# Copyright (C) 2010-2011 Xelhua Development Group, et al. +# This program is free software; rights to this code are stated in doc/LICENSE. +package M::LOLCAT; +use strict; +use warnings; +use API::Std qw(cmd_add cmd_del trans); +use API::IRC qw(privmsg notice); +use Acme::LOLCAT; + +# Initialization subroutine. +sub _init { + # Create LOLCAT command. + cmd_add('LOLCAT', 0, 0, \%M::LOLCAT::HELP_LOLCAT, \&M::LOLCAT::cmd_lolcat) or return; + # Success. + return 1; +} + +# Void subroutine. +sub _void { + # Delete LOLCAT command. + cmd_del('LOLCAT') or return; + # Success. + return 1; +} + +# Help for LOLCAT. +our %HELP_LOLCAT = ( + en => "This command will translate English to LOLCAT speak. \2Syntax:\2 LOLCAT <text>", +); + +# Callback for LOLCAT command. +sub cmd_lolcat { + my ($src, @argv) = @_; + + # At least one parameter is required. + if (!defined $argv[0]) { + notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.}); + return; + } + + # Return LOLCAT translation. + privmsg($src->{svr}, $src->{chan}, 'Result: '.translate(join q{ }, @argv)); + + return 1; +} + +# Start initialization. +API::Std::mod_init('LOLCAT', 'Xelhua', '1.00', '3.0.0a8', __PACKAGE__); +# build: perl=5.010000 cpan=Acme::LOLCAT + +__END__ + +=head1 NAME + +LOLCAT - Translates English into LOLCAT. + +=head1 VERSION + + 1.00 + +=head1 SYNOPSIS + + <starcoder> !lolcat You too can speak like a lolcat! + <Auto> Result: YU T CAN SPEKK LIEK LOLCAT! KTHXBYE! + +=head1 DESCRIPTION + +This will create the LOLCAT command which allows you to translate English text +into LOLCAT speak. + +See also: http://en.wikipedia.org/wiki/Lolcat + +=head1 DEPENDENCIES + +This module is dependent on the following modules from CPAN: + +=over + +=item L<Acme::LOLCAT> + +This is what the module uses to translate English into LOLCAT. + +=back + +=head1 AUTHOR + +This module was written by Elijah Perrault. + +This module is maintained by Xelhua Development Group. + +=head1 LICENSE AND COPYRIGHT + +This module is Copyright 2010-2011 Xelhua Development Group. + +Released under the same licensing terms as Auto itself. + +=cut + +# vim: set ai et ts=4 sw=4: