O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  


 
Buy the book!
IRC Hacks
By Paul Mutton
July 2004
More Info

How do these hacks stand up? Comment on a hack from the book by choosing the associated "Discuss" link below. You can also view the code from any of the hacks by clicking on the "Listing" or "Code" links. A number of hacks have been selected to be featured online in their entirety; you may view those hacks by clicking on the hack titles that are linked.

You can also download all the scripts and other files for this book here.

Jump to: Connecting to IRC  | Using IRC  | Users and Channels  | Enhancing IRC Clients  | Writing IRC Bots  | Logging Bots  | Community Bots  | Search and Query Bots  | Fun Bots  | Announcement Bots  | Network Bots  | Channel Management Bots  | The IRC Protocol  | Other Ways to Connect to IRC  | Servers and Services

Connecting to IRC

HACK
#1

IRC from Windows
Ask any Windows user what he uses to connect to IRC, and the chances are he will say mIRC
[Discuss (2) | Link to this hack]

HACK
#2

IRC from Linux
XChat is a popular IRC client with a graphical user interface. You can download the source code or precompiled binaries for a variety of platforms
[Discuss (0) | Link to this hack]

HACK
#3

IRC from Mac OS X
Several IRC clients are available for Mac OS X. Check them out for your favorite features
[Discuss (0) | Link to this hack]

HACK
#4

IRC with ChatZilla
Jump around platforms with the ChatZilla IRC client for Mozilla-based web browsers
[Discuss (0) | Link to this hack]

Using IRC

HACK
#5

The IRC Model
If you are totally new to IRC, you may be wondering where to begin. Understand the conceptual model of Internet Relay Chat for a good start
[Discuss (0) | Link to this hack]

HACK
#6

Common Terms, Abbreviations, and Phrases
Once you get into IRC, you need to understand the barrage of abbreviations and phrases that are commonly used
[Discuss (0) | Link to this hack]

HACK
#7

Common Acronyms and Initialisms
Master the obscure acronyms people use on IRC to save keystrokes
[Discuss (0) | Link to this hack]

HACK
#8

Register with NickServ
All nicknames on an IRC network must be unique, so if someone steals your nickname, you won't be able to use it. Protect your nickname and get it back with NickServ
[Discuss (2) | Link to this hack]

HACK
#9

Register Your Channel with ChanServ
Are you having problems with unruly users causing mayhem in your channel? Protect your channel with the ChanServ service
[Discuss (0) | Link to this hack]

HACK
#10

The QuakeNet L Channel Bot
ChanServ and NickServ aren't always available. When on QuakeNet, use the L bot to manage your channels
[Discuss (0) | Link to this hack]

HACK
#11

Fix Channel Problems with CHANFIX
EFnet is the oldest IRC network in the world and does not use IRC Services. But it's CHANFIX to the rescue if problems occur in your channel
[Discuss (1) | Link to this hack]

Users and Channels

HACK
#12

Find Relevant Channels and Servers
If you're new to IRC, one of the biggest problems is working out which network to use. Find a perfect match with one of the search engines for IRC channels
[Discuss (0) | Link to this hack]

HACK
#13

Guess the Time Zone of a User
You're almost off to bed while other users on the channel seem to just get out of bed. That's what happens when IRC is available all over the world, but how can you find out if someone is likely to be awake?
[Discuss (0) | Link to this hack]

HACK
#14

Study Channel Statistics with pisg
Most IRC clients will give you the option of saving messages to a log file. Generate entertaining statistics from these log files
[Discuss (0) | Link to this hack]

HACK
#15

Find Users in Channels
Finding someone on IRC is not always that easy, particularly if you don't know his exact nickname. Write some scripts and discover who's in a channel
The Code
[Discuss (0) | Link to this hack]

HACK
#16

Filter Channel Lists
Even if you've already found a satisfactory IRC network, you may have missed some interesting channels. Discover them in the output from the LIST command
The Code
[Discuss (0) | Link to this hack]

Enhancing IRC Clients

HACK
#17

Automatic Completion of Nicknames
Your client does the typing so that you don't have to
[Discuss (0) | Link to this hack]

HACK
#18

Add Timestamps to mIRC Messages
If you leave your IRC client running all the time, learn when each message was sent
[Discuss (0) | Link to this hack]

HACK
#19

Highlight Lines in mIRC
Some channels are just too busy for you to keep track of everything that's happening. Highlight lines that contain certain keywords to easily see what's relevant to you
[Discuss (0) | Link to this hack]

HACK
#20

Automate mIRC with Scripting
mIRC is already a friendly and easy-to-use IRC client. Master its scripting capabilities to automate lots of useful tasks
[Discuss (0) | Link to this hack]

HACK
#21

Format Text
IRC does not limit you to using plain text. Add extra formatting, such as underlining and italics, to your messages
[Discuss (0) | Link to this hack]

HACK
#22

Colorize Text
Not only can you add formatting to text, but you can also add colors. Use them to make your messages stand out
[Discuss (0) | Link to this hack]

HACK
#23

Play Sounds
IRC doesn't have to be solely text based. Add excitement by getting your IRC client to play sounds and share those sounds with other users
[Discuss (0) | Link to this hack]

HACK
#24

Enhance irssi with Perl
irssi is a popular IRC client. Enhance it with Perl scripts you write yourself or select from the large range available on the Web
The Code
[Discuss (0) | Link to this hack]

HACK
#25

Connect to Multiple Servers
Use more than one IRC network at a time from a single IRC client
[Discuss (0) | Link to this hack]

HACK
#26

Secure Your IRC Connection with SSL
Hide your conversations on IRC from prying eyes on the Internet
[Discuss (0) | Link to this hack]

HACK
#27

Tunnel Your IRC Connection with SSH
Encrypt your conversation and access IRC servers through firewalls using SSH
[Discuss (0) | Link to this hack]

HACK
#28

Automate Voice Management
Large channels are inevitable targets for abuse. Help prevent problems by creating a client script that is responsible for handing out voice status to deserving users
The Code
[Discuss (0) | Link to this hack]

HACK
#29

Make IRC Talk
Even when you can't keep your IRC client in view, keep track of IRC by making your IRC client talk to you
The Code
[Discuss (0) | Link to this hack]

HACK
#30

Add Your IRC Nickname to Your Webcam
Webcams are a great way of showing people what you're doing. With a little IRC scripting, show people your current nickname, too
[Discuss (0) | Link to this hack]

Writing IRC Bots

HACK
#31

IRC Over Telnet
Make a raw connection to an IRC server and spend a little time trying out the IRC protocol commands you'll be using in your program directly
[Discuss (0) | Link to this hack]

HACK
#32

A Simple Perl IRC Client
Build a simple IRC robot that connects to an IRC server and joins a channel of your choosing
The Code
[Discuss (4) | Link to this hack]

HACK
#33

IRC with Perl and Net::IRC
The IRC protocol looks a bit weird and can be hard to understand. Fortunately, you don't have to know it to make a bot
The Code
[Discuss (0) | Link to this hack]

HACK
#34

A Simple Java IRC Client
If you want to make an IRC client that can run on a variety of platforms, Java provides one possible solution
The Code
[Discuss (0) | Link to this hack]

HACK
#35

IRC with Java and PircBot
Use the PircBot Java IRC API to make bots that connect to IRC
[Discuss (0) | Link to this hack]

HACK
#36

A Simple Python IRC Client
Python doesn't include an IRC module as standard, but connecting is nonetheless easy. Make a simple client that connects to an IRC server
The Code
[Discuss (1) | Link to this hack]

HACK
#37

IRC with Python and IRCLib
Rather than reinventing the wheel each time you want to make a Python IRC bot, use an IRC library such as the IRCLib module
The Code
[Discuss (0) | Link to this hack]

HACK
#38

Extend the Python IRCLib
Not every program needs the same features from an IRC library. Extend IRCLib for your specific purposes
The Code
[Discuss (0) | Link to this hack]

HACK
#39

The Ethics of IRC Bots
You put your shiny new bot in a channel and suddenly a channel operator comes along and kicks it out. Why did they do that?
[Discuss (0) | Link to this hack]

Logging Bots

HACK
#40

Keep Tabs on People
Keep track of when visitors to a channel last spoke and what they said
The Code
[Discuss (0) | Link to this hack]

HACK
#41

Log URLs People Mention
Logging URLs on IRC is useful in case you need to refer to them later on. Learn an unusual and interesting way to do it with a shell script on Linux/Unix
The Code
[Discuss (1) | Link to this hack]

HACK
#42

Blog from IRC
Your IRC channel is essentially a community of people. Publish the thoughts of this community by using an IRC bot to place them on a group web log
The Code
[Discuss (0) | Link to this hack]

HACK
#43

A Continuity Bot
What was everyone talking about just before you joined the middle of their conversation?
The Code
[Discuss (0) | Link to this hack]

Community Bots

HACK
#44

Infer Social Networks from IRC
Most IRC channels are like small communities, and communities make patterns. Use this hack to produce pretty drawings of the social structure in your channel
[Discuss (1) | Link to this hack]

HACK
#45

Run an Infobot
Set up an infobot to sit in your channel, learning facts and reeling off useful information
[Discuss (0) | Link to this hack]

HACK
#46

Use PPF for Gaming Clans
Many online gamers hang out together on IRC. Extend the IRC bot PPF with plug-ins to support these communities and provide various game-related tools
[Discuss (0) | Link to this hack]

HACK
#47

Write a Plug-in for PPF
Now that you know how to use the PircBot Plug-in Framework and configure its various plug-ins, let your creative juices flow by making your own plug-in
The Code
[Discuss (0) | Link to this hack]

HACK
#48

Getting Friendly with FOAFBot
Come to grips with the Semantic Web by using FOAFBot to find out information about your friends and strangers alike
[Discuss (0) | Link to this hack]

HACK
#49

Interrogate Trust Networks with TrustBot
Use the network of trust ratings available on the Web to recommend how much to trust an unknown individual and send your recommendations over IRC
[Discuss (0) | Link to this hack]

HACK
#50

Pass Notes to Other Users
Not everybody can afford to be permanently connected to IRC, but it is still often a preferred medium for communication. Pass messages on to other users when they next join the channel with this simple IRC bot
The Code
[Discuss (0) | Link to this hack]

Search and Query Bots

HACK
#51

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
The Code
[Discuss (0) | Link to this hack]

HACK
#52

Use the Dictionary
Create a bot to look up the meaning of a word for you or to show the meaning of a word to other people in your channel
The Code
[Discuss (1) | Link to this hack]

HACK
#53

Check the Weather
Check the up-to-the-minute weather with an IRC bot that capitalizes on Web Services—a powerful way of getting current information
The Code
[Discuss (1) | Link to this hack]

HACK
#54

Don't Get Lost in Translation
Since IRC is accessible from anywhere in the world, cross the language barriers with a translator bot
The Code
[Discuss (0) | Link to this hack]

HACK
#55

Convert Currency
Most people refer to a newspaper or web site to do currency conversions. Let an IRC bot using an appropriate Web Service do all the hard work for you
The Code
[Discuss (0) | Link to this hack]

HACK
#56

Find Out When People Are on the Network
People aren't always connected to IRC 24/7. Find out when they are
The Code
[Discuss (0) | Link to this hack]

HACK
#57

Search for Books on Amazon
With the Amazon Web Services Developer's Kit, perform keyword searches and return the results to IRC
The Code
[Discuss (0) | Link to this hack]

Fun Bots

HACK
#58

A DiceBot
If you're an adventure gamer who likes to use IRC, make your own bot to roll the dice for you and your friends
The Code
[Discuss (0) | Link to this hack]

HACK
#59

An Egg Timer
Create an IRC bot that can remind you to do something after a set interval
The Code
[Discuss (0) | Link to this hack]

HACK
#60

A Trivia Bot
Turn an IRC bot into an automated quiz show host. Compete with your friends to be first to answer each question
The Code
[Discuss (1) | Link to this hack]

HACK
#61

Perform Feats of Math
Lose your calculator. Evaluate mathematical expressions with a bot that uses the Java Expression Parser
The Code
[Discuss (0) | Link to this hack]

HACK
#62

An Artificial Intelligence Bot
Use the JMegaHal package in a PircBot-based IRC bot that learns from and chats with other users
The Code
[Discuss (0) | Link to this hack]

HACK
#63

Create Comic Strips
IRC chat certainly has its moments. Wouldn't it be great if you could immortalize some of these moments in the form of a comic strip?
[Discuss (0) | Link to this hack]

Announcement Bots

HACK
#64

Welcome Visitors Automagically
Create a simple bot that welcomes visitors to your IRC channels
The Code
[Discuss (0) | Link to this hack]

HACK
#65

Announce Newsgroup Posts
Moderated newsgroups are updated only every so often. Have an IRC bot check for new posts instead of wasting your time
The Code
[Discuss (0) | Link to this hack]

HACK
#66

Feed Syndicated RSS News
Have an IRC bot bring home the latest stories from an RSS feed instead of visiting your favorite news web sites every hour
The Code
[Discuss (1) | Link to this hack]

HACK
#67

Watch Online Games with MatchEd
Many online gamers use IRC to organize battles and discuss tactics. MatchEd lets you watch the progress of a game from the safety of IRC
[Discuss (0) | Link to this hack]

Network Bots

HACK
#68

Link Channels on Multiple Networks
How do you encourage a community on one network to talk to those on another network? Create a bot that can relay messages between the networks
The Code
[Discuss (0) | Link to this hack]

HACK
#69

Get a Remote Shell
It's great to have remote access to an operating system. Build such features into your own IRC bot!
The Code
[Discuss (0) | Link to this hack]

HACK
#70

Tail Log Files
Keeping track of your log file activity is even easier when you can view real-time logs over IRC
The Code
[Discuss (1) | Link to this hack]

HACK
#71

Bridge Two Infobots
Combining the knowledge of infobots running on different servers is a useful way of sharing information between two communities
The Code
[Discuss (0) | Link to this hack]

HACK
#72

A File-Sharing Bot
Want to share files on IRC without the hassle of having to send anything manually? Use this IRC bot to tell people what files you're sharing and automatically offer them for download
The Code
[Discuss (0) | Link to this hack]

Channel Management Bots

HACK
#73

Protect the Channel Topic
Set your channel's topic to something inviting and friendly—and make sure it stays that way
The Code
[Discuss (0) | Link to this hack]

HACK
#74

Invite Users into Channels
The safest way to keep a channel under control and free from unwanted intruders is to mark it as invite-only. Of course, you need a nice way of letting the regular users in
The Code
[Discuss (0) | Link to this hack]

HACK
#75

Maintain Operator Status
Losing operator status in your own channel can be a nuisance. Create an IRC bot that automatically grants operator status to those who deserve it
The Code
[Discuss (0) | Link to this hack]

HACK
#76

Set Up an Eggdrop Bot
Eggdrops have been around for quite a few years, so plenty of authors have had time to write Tcl scripts or C modules that make these kinds of bots very powerful. This hack shows you how to install and set up a simple Eggdrop
[Discuss (0) | Link to this hack]

HACK
#77

Manage Channels with an Eggdrop
Eggdrops are pretty neat bots for handling channels. Use one to prevent people flooding and to give out ops and voice
[Discuss (2) | Link to this hack]

The IRC Protocol

HACK
#78

Understanding the IRC Protocol
The IRC protocol is a text-based protocol. Exploit it with just a little knowledge of its features and restrictions
[Discuss (0) | Link to this hack]

HACK
#79

Text Over Multiple Lines
If you send a message that is too long, the end of it could get chopped off, leaving the recipient wondering in anticipation what you meant to say. Why is this a problem and how can you solve it?
[Discuss (0) | Link to this hack]

HACK
#80

Fake an Ident Response
Fake a simple Identification Protocol server to convince IRC servers who you are
The Code
[Discuss (0) | Link to this hack]

HACK
#81

Strip Formatting from Messages
Parsing the content of a message is difficult if it contains strange formatting characters. Make it easier for IRC bots to parse these messages by removing those characters
[Discuss (0) | Link to this hack]

HACK
#82

Remove Color from Messages
Parsing messages is difficult when they contain color characters. Make messages easier to store and parse by removing these characters
[Discuss (0) | Link to this hack]

HACK
#83

Encrypt Messages
Privacy is very important to some people. The only way to ensure that other people cannot read your messages is to encrypt them
The Code
[Discuss (0) | Link to this hack]

HACK
#84

Timestamp with the TS Protocol
Master the TS Protocol to prevent people from exploiting the situation when servers relink after a netsplit has broken the IRC network into separate parts
[Discuss (0) | Link to this hack]

HACK
#85

Understanding CTCP Messages
CTCP messages are used quite frequently on IRC. Learn what they mean so you can use them effectively
[Discuss (0) | Link to this hack]

Other Ways to Connect to IRC

HACK
#86

Hypertext Links to IRC Channels
Looking for an easy way to get people to join your channel? Add IRC hyperlinks to your web pages
[Discuss (0) | Link to this hack]

HACK
#87

IRC from Your Mobile Phone
Get out from behind the desk, and IRC from your mobile phone. Everywhere you go, you can take the channels with you
[Discuss (0) | Link to this hack]

HACK
#88

Enemies of Mobile IRC
Mobile IRC has different limitations than the normal experience. Meet eight enemies of mobile IRC, and learn how to defeat them
[Discuss (0) | Link to this hack]

HACK
#89

IRC from a Pocket PC
If you're constantly on the move, whether it be roaming around your home or trekking in the mountains, IRC is only a few taps away on your Pocket PC
[Discuss (0) | Link to this hack]

HACK
#90

Access IRC with Java Applets
Even if visitors to your web site don't have an IRC client installed, you can still try to persuade them to join your IRC channel by using a Java Applet client
[Discuss (0) | Link to this hack]

HACK
#91

Use IRC from a Web Page Without Java
Use IRC from any browser—even mobile devices that don't support Java!
[Discuss (0) | Link to this hack]

HACK
#92

Use IRC Within screen
If you're regularly on the move, you need a way to keep track of IRC while away from your computer. Run a console-based IRC client in screen as a simple yet powerful solution
[Discuss (0) | Link to this hack]

HACK
#93

Set Up an IRC Proxy
IRC everywhere and never miss anything with an IRC proxy/bouncer
[Discuss (0) | Link to this hack]

HACK
#94

Use irssi and Its Proxy
irssi is a highly configurable and scriptable IRC client for Unix. Its proxy feature can open the doors to more advanced use
[Discuss (0) | Link to this hack]

Servers and Services

HACK
#95

Set Up Your Own IRC Server for Unix/Linux
Whether it's for testing bots or chatting with your mates, set up your own server for the ultimate power and sense of achievement
[Discuss (0) | Link to this hack]

HACK
#96

Install Services
You've used the so-called "Services" on various IRC networks, but have you ever wondered how to set them up for your own IRC server?
[Discuss (0) | Link to this hack]

HACK
#97

Set Up Your Own beware ircd Server
If you want a quick and easy IRC server, install and run the beware ircd IRC server on Windows
[Discuss (0) | Link to this hack]

HACK
#98

Link Two IRC Servers Together
If your IRC server starts getting too busy, the only real solution is to turn it into a network of IRC servers
[Discuss (0) | Link to this hack]

HACK
#99

Use MSN/ICQ/Jabber from IRC
You may feel very comfortable with IRC, but some people prefer to stick with other instant messenger networks like ICQ or MSN. Get in touch with these people
[Discuss (0) | Link to this hack]

HACK
#100

Combine BitlBee and CtrlProxy
We've already covered both BitlBee and CtrlProxy separately, but IRC power users will be delighted to learn how effective the two combined can be
[Discuss (0) | Link to this hack]


O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.