Irssi Alias Magic using Perl

Posted by hank, Fri Aug 17 06:01:00 UTC 2007

Now, be aware that this could be a security issue if you let strangers onto your IRC session. They could do some cool shell tricks to break out of this exec command into the raw shell itself, but I’ll forget about that for now. I wanted an alias that would allow me to send a command to my bot to shorten a URL as well as announce the URL into the channel using some good old-fashioned ANSI Color.


/alias fu exec -o perl -e 'print "\#furryurl \${ARGV[0]}\\n"\; print "C4\$ARGV[1]" if(length(\$ARGV[1]))' -- "$0" "$1-"

Note: The C in C4\$ARGV[1] is really a CONTROL-C.

Run this in irssi, and you’ll get some sweet output:


# Upon running /fu http://www.google.com ralree
# The text for 'ralree' is actually colored red on output.
01:59:03 < hardwarehank> #furryurl http://www.google.com
01:59:04 < hardwarehank> ralree
01:59:04 < rufis> hardwarehank: http://www.furryurl.com/hx

I’m so happy!

Tags:

Comments

Have your say

A name is required. You may use Markdown in your comments.