Introduction: Hacks 40-43

 <  Day Day Up  >  

Introduction: Hacks #40-43

Logging is a natural function for bots and clients alike. Many IRC clients offer the ability to append messages to log files, and it is trivial to add such features to a bot. The secret of effective logging is to work out what you want to log and how people can access the information. This provides some quite creative ideas that go beyond the simple task of merely logging every message to a file.

A bot that monitors all messages sent to a channel is effectively monitoring the activity of all users in that channel. By providing an interface that lets people talk to the bot, you can let them find out when a particular user was last seen and what that user said in the channel. This chapter shows you how to implement such a bot using the PircBot package covered in Chapter 5.

It is perhaps surprising to learn that bots can even be written in shell scripts. This chapter shows you how to write a basic bot that uses bash to connect to IRC and log all URLs that it sees. Another bot written in Java can tell you what people were talking about before you joined a channel, so you will never feel as if you've blindly wandered into the middle of a conversation.

A more complicated example uses a Java bot to run a group blog, logging URLs to a MySQL database. A web-based frontend then lets people view the logged URLs.

 <  Day Day Up  >  


IRC Hacks
IRC Hacks
ISBN: 059600687X
EAN: 2147483647
Year: 2004
Pages: 175
Authors: Paul Mutton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net