Need to quickly integrate some IRC into your app? Running Linux? Try ii

I know, it looks like a typo, but the script ii makes IRC all better for small applications which don’t need their own re-implementation of an IRC client.

I know it’s available under Ubuntu and Debian (apt-get install ii), but I don’t know what other platforms it’s available for.

It’s not much use as a user-focused IRC client (although it would vaguely work like that with a little scripting!), but for scripts it works like a charm.

Fire it up:

ii -s IrcNetworkNode -n YourBotNickName &

You should now notice that there’s a directory been created in your home directory. Change directory to there, and you’ll see there’s now a directory for the server you just connected to. Go into that directory, and you’ll see two files, in and out.

out is just a simple text file, which you can follow with tail, or your script can just iterate over, but in is known as a FIFO, or “File In, File Out” – whatever gets put in first gets taken out first and processed, in this case, by the ii script.

echo "/j #ChannelName" > /home/username/irc/irc.network/in

This will create a new directory called #channelname, in which will be two new files, yep, you guessed it, in and out
.

Anything you write to in or read from out in this directory will be interacting with the channel. You can also send

echo "/j nickserv identify botpassword" > /home/username/irc/irc.network/in

Which will start a conversation with nickserv (in this case) rather than a channel.

If you want to find out more about this fantastic little script, head over to http://tools.suckless.org/ii/ and take a look.

JonTheNiceGuy

He/Him. Husband and father. Linux advocating geek. Co-Host on the AdminAdmin Podcast, occasional conference speaker.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.