Skip to Content
IRC Hacks
book

IRC Hacks

by Paul Mutton
July 2004
Intermediate to advanced
432 pages
11h 15m
English
O'Reilly Media, Inc.
Content preview from IRC Hacks

Chapter 5. Writing IRC Bots

Introduction: Hacks #31-39

IRC bots are programs that connect to IRC. They differ from the classic IRC client in that they are usually autonomous—they think for themselves and do not require direct human input to work.

Programming IRC bots is fun and allows you to be very creative, as you are responsible for everything they say and do. Later chapters will show you how to create all sorts of IRC bots to log channels, create comic strips, pass on messages, share files, and so on. The limit is your imagination.

The first step in creating your own IRC bot is to understand the basic handshake that goes on when you connect to an IRC server. An example is given, showing you how to connect to an IRC server using no more than a basic Telnet application. Once connected, you can use Telnet to join channels and send messages to people. This illustrates the simplicity of the text-based IRC protocol, and the chapter continues by showing you how to write simple Perl, Java, and Python programs to connect to IRC.

This chapter also introduces some libraries for connecting to IRC. This lets you forget about the intricacies of the IRC protocol and concentrate on the functionality of your IRC bot. This covers the Net::IRC module for Perl, the PircBot package for Java, and the IRCLib module for Python.

Of course, one can perform many tasks with IRC bots, and not all of them are good. The chapter is rounded off with a brief discussion of the ethics of running IRC bots.

IRC Over ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Wireless Hacks

Wireless Hacks

Rob Flickenger
The Spotify Play

The Spotify Play

Sven Carlsson, Jonas Leijonhufvud

Publisher Resources

ISBN: 059600687XErrata Page