X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FUserExtra.pl;h=cb0dc29ce0456785756e195a3e38fd99dcac0a00;hb=9d62b4d8391174e9b89934d36af6cfb61f76cb8a;hp=7112f97a7d314ad2fee479a4d6f307cc2505672f;hpb=7e9454999bd5f3cf81770425565b25ed55438401;p=infobot.git 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;