Chapter 8. Search and Query Bots
Introduction: Hacks #51-57
Search and query bots are very common on IRC. You may find that lots of IRC users will use a bot in preference to a web-based search tool, simply because it is less effort than starting up a web browser and typing in a URL.
The first hack shows you how to create a bot that performs Google searches using the Google and PircBot APIs. Conveniently, most IRC clients will highlight the resulting URLs and let you click on them to load the page in your default web browser.
Web Services provide powerful and easy ways to access information over the Internet and present the results in your application. This chapter shows you how to make some Java bots that employ Web Services to see what the weather is like, translate languages, convert currencies, and search for books on Amazon.
Not all searches have to be performed over the Internet. A more local type of search can be used to determine if a certain user is connected to your IRC network, even if she is not in any of your channels. This is useful if you are trying to get a hold of somebody who doesn’t use IRC that much and connects only infrequently.
Search the Web with Google
Performing Google searches from IRC is not only convenient, but also efficient. See how fast you can Google for something on IRC and click on the URL highlighted by your IRC client.
When someone pops into your IRC channel with a question, you can bet your life that 9 times out of 10, he could have easily found ...
Get IRC Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.