From 9eed830f296dab257759f5276d0963467007aa6b Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 26 Dec 2024 17:08:34 -0500 Subject: initial commit --- jumble.pl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 jumble.pl (limited to 'jumble.pl') diff --git a/jumble.pl b/jumble.pl new file mode 100644 index 0000000..79ac4fa --- /dev/null +++ b/jumble.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl + +# script was written ages ago (probably 2008 or earlier). + +use warnings; +use strict; + +use Irssi qw/command command_bind/; + +our $VERSION = "0.1"; +our %IRSSI = ( + authors => 'Urchlay', + contact => 'Urchlay on NewNet', + name => 'jumble', + description => 'Smiultae bad tpying', + license => 'Same as Perl', + url => 'none', +); + +sub jumble { + my ($text, $srv, $chan) = @_; + my @words = split /\s+/, $text; + + for(@words) { + if(length($_) > 2) { + /(\W*\w)(\w+)(\w\W*)/; + if($2) { + my $start = $1; + my $middle = $2; + my $end = $3; + + my @letters = split "", $middle; + for(0..$#letters-1) { + ($letters[$_], $letters[$_+1]) = ($letters[$_+1], $letters[$_]) + if rand > 0.5; + } + $_ = $start . join("", @letters) . $end; + } + } + } + + $chan->command('MSG ' . $chan->{name} . ' ' . join(" ", @words)); +} + +command_bind("jumble", \&jumble); -- cgit v1.2.3