Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # randomize nick
- #use Irssi;
- #use Irssi::Irc;
- use strict;
- use vars qw($VERSION %IRSSI);
- #use utf8;
- $VERSION = "1.00";
- %IRSSI = (
- authors => 'Abraham Shapirus',
- name => 'shred',
- description => 'slaps one with one\'s nick totally screwed',
- license => 'Public Domain'
- );
- sub shred
- {
- my $orig = shift;
- # utf8::upgrade $orig;
- my @orig = split //, $orig;
- my $ret = '';
- while ($#orig >= 0) {
- my $rnd = int(rand($#orig + 1));
- $ret .= $orig[$rnd];
- splice @orig, $rnd, 1;
- }
- return $ret;
- }
- sub cmd_shred
- {
- my ($data, $server, $channel) = @_;
- $data =~ s/^\s+//;
- $data =~ s/\s+$//;
- my $orig = $data;
- if (length($data) > 3) {
- my ($head, $body, $tail) = $data =~ m/^(.)(.+?)(.)$/;
- $data = $head . shred($body) . $tail;
- $channel->command("/me shreds $orig into $data with a lightsaber") if $channel;
- # Irssi::print("the channel is:".$channel->{name});
- }
- }
- sub cmd_throw
- {
- my ($data, $server, $channel) = @_;
- $data =~ s/^\s+//;
- $data =~ s/\s+$//;
- my $orig = $data;
- if (length($data) > 3) {
- my ($head, $body, $tail) = $data =~ m/^(.)(.+?)(.)$/;
- $data = $head . shred($body) . $tail;
- Irssi::print("@_");
- $channel->command("/me shreds $orig into $data with a lightsaber and throws remains into deep space") if $channel;
- }
- }
- Irssi::command_bind('slap', 'cmd_shred');
- Irssi::command_bind('slap1', 'cmd_shred1');
- Irssi::command_bind('throw', 'cmd_throw');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement