From: timriker Date: Mon, 28 Feb 2005 02:53:55 +0000 (+0000) Subject: rot* X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9d62b4d8391174e9b89934d36af6cfb61f76cb8a;p=infobot.git rot* git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1188 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/UserExtra.pl b/src/UserExtra.pl index 7112f97..cb0dc29 100644 --- a/src/UserExtra.pl +++ b/src/UserExtra.pl @@ -585,15 +585,20 @@ sub userCommands { } # rot13 it. - if ($message =~ /^rot13(\s+(.*))?/i) { - my $reply = $2; + if ($message =~ /^rot([0-9]*)(\s+(.*))?/i) { + my $reply = $3; if (!defined $reply) { &help("rot13"); return; } + my $num = $1 % 26; + my $upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + my $lower="abcdefghijklmnopqrstuvwxyz"; + my $to=substr($upper,$num).substr($upper,0,$num).substr($lower,$num).substr($lower,0,$num); + eval "\$reply =~ tr/$upper$lower/$to/;"; - $reply =~ y/A-Za-z/N-ZA-Mn-za-m/; + #$reply =~ y/A-Za-z/N-ZA-Mn-za-m/; &performStrictReply($reply); return;