Share

IRCCat public release - sys/devteam wonderbot

21 Feb 2007, 16:57

UPDATE http://www.last.fm/user/RJ/journal/2008/01/21/s5_irccat_update_released

Matt and Anil spoke at the Future of Web Apps conference yesterday, and mentioned one of our favourite development support tools, the irccat bot.

At last.fm, all the developers join an irc channel which we use for communications, sharing links, bugs etc.. and into which various system messages are automatically sent via irccat.

Once irccat is running and in your channel, you can do this:

echo "Blah blah status message" | netcat -q0 devmachine.last.fm 12345

..and the bot writes the message to an irc channel.

From irccat/README:

As in `cat` to IRC.

IRCcat does 2 things:

1) Listens on a specific ip:port and writes incoming data to an IRC channel.
This is useful for sending various announcements and log messages to irc
from shell scripts, Nagios and other services.

2) Hands off commands issued on irc to a handler program (eg: shell script)
and responds to irc with the output of the handler script. This only
happens for commands addressed to irccat: or prefixed with ?.
(easily extend irccat functionality with your own scripts)



Here is the source code - it's a few dozen lines of hastily written java and a couple of other scripts:

http://static.last.fm/rj/irccat.tar.bz2

The README contains example code for SVN post-commit hooks, Nagios alerts and Trac ticket notifications via irccat. We use irccat for a variety of other things, mostly automated scripts that report their progress/status.

The ?commands which invoke a shell script are a great way to add functionality. Here are some irrelevant examples:

[16:56:13] <RJ> ?lookup user 1000002
[16:56:13] <irccat> user.id(1000002) RJ http://www.last.fm/user/RJ/ (SUBSCRIBER)
[16:57:57] <RJ> ?lookup unixtime 1172046930
[16:57:57] <irccat> 1172046930 -> Wednesday 21 February 2007, 08:35:30 UTC
[16:58:14] <RJ> ?uptime
[16:58:14] <irccat> 16:56:12 up 245 days, 19:13, 72 users, load average: 0.37, 0.38, 0.37


Enjoy.

Comments

See all 6 comments
Leave a comment. Log in to Last.fm or sign up (it’s free).