diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:19:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:19:02 +0000 |
commit | 03929dac2a29664878d2c971648a4fe1fb698462 (patch) | |
tree | 02c5e2b3e006234aa29545f7a93a1ce01b291a8b /scripts/vowels.pl | |
parent | Initial commit. (diff) | |
download | irssi-scripts-upstream/20231031.tar.xz irssi-scripts-upstream/20231031.zip |
Adding upstream version 20231031.upstream/20231031upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/vowels.pl')
-rw-r--r-- | scripts/vowels.pl | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/scripts/vowels.pl b/scripts/vowels.pl new file mode 100644 index 0000000..eae47d7 --- /dev/null +++ b/scripts/vowels.pl @@ -0,0 +1,93 @@ +#!/usr/bin/perl -w + +# /VSAY <text> +# - same as /say, but removes vowels from text +# +# /VME <text> +# - same as /me, but removes vowels from text +# +# /VTOPIC <text> +# - same as /topic, but removes vowels from text :) + +# Written by Jakub Jankowski <shasta@atn.pl> +# for Irssi 0.7.98.4+ + +use strict; +use vars qw($VERSION %IRSSI); + +$VERSION = "1.0"; +%IRSSI = ( + authors => 'Jakub Jankowski', + contact => 'shasta@atn.pl', + name => 'vowels', + description => 'Silly script, removes vowels, idea taken from #linuxnews ;-)', + license => 'GNU GPLv2 or later', + url => 'http://irssi.atn.pl/', +); + +use Irssi; +use Irssi::Irc; + +# str remove_vowels($string) +# returns random-coloured string +sub remove_vowels { + my ($string) = @_; + $string =~ s/[eyuioa]//gi; + return $string; +} + +# void rsay($text, $server, $destination) +# handles /rsay +sub rsay { + my ($text, $server, $dest) = @_; + + if (!$server || !$server->{connected}) { + Irssi::print("Not connected to server"); + return; + } + + return unless $dest; + if ($dest->{type} eq "CHANNEL" || $dest->{type} eq "QUERY") { + $dest->command("/msg " . $dest->{name} . " " . remove_vowels($text)); + } +} + +# void rme($text, $server, $destination) +# handles /rme +sub rme { + my ($text, $server, $dest) = @_; + + if (!$server || !$server->{connected}) { + Irssi::print("Not connected to server"); + return; + } + + return unless $dest; + if ($dest->{type} eq "CHANNEL" || $dest->{type} eq "QUERY") { + $dest->command("/me " . remove_vowels($text)); + } +} + +# void rtopic($text, $server, $destination) +# handles /rtopic +sub rtopic { + my ($text, $server, $dest) = @_; + + if (!$server || !$server->{connected}) { + Irssi::print("Not connected to server"); + return; + } + + return unless $dest; + if ($dest->{type} eq "CHANNEL") { + $dest->command("/topic " . remove_vowels($text)); + } +} + +Irssi::command_bind("vsay", "rsay"); +Irssi::command_bind("vtopic", "rtopic"); +Irssi::command_bind("vme", "rme"); + +# changes: +# +# 07.02.2002: Initial release (v1.0) |