Main Navigation

Content

Perl for Writing Chat Robots and Scripts (IRC, Jabber, etc.)

Learn Perl Now!
And get a job doing Perl.

Introduction

Perl allows one to write IRC robots and other forms of chat automation (such as special IRC or Jabber client commands) with ease, and many active Perl programmers and contributors have got their feet wet in Perl after using it to write a simple bot or a chat script.

Since the advent of the IRC - the Internet Relay Chat protocol, people have been automating it by writing dedicated robots or "bots", such as chat bots, which are used for amusement; infobots, which are used to collect various factoids, and handily recall them, evalbots which are used to evaluate code, but there are many others including many multi-purpose bots.

Recently, there has been some proliferation of different protocols for instant messaging or chat, such as the open-source and open-specification Jabber/XMPP protocol, which has gained some further popularity after it has been supported by providers such as Google Talk / Google Chat and Facebook.com.

For IRC

If you want to write something for IRC, take these recommendations to heart:

  1. Don't parse the IRC protocol directly (using regular expressions or whatever). Use a module.
  2. Don't use Net-IRC which is very limited, broken, and is unmaintained.

There are many bad examples doing that on the web, and you should not follow them if you want to write your own robot or script from scratch. If you want to contribute to an existing codebase that uses these legacy methods, please make it a priority to convert it to a more modern IRC framework.

POE-Component-IRC

POE-Component-IRC (or PoCoIrc for short) has been the first successful attempt at providing a decent IRC framework for Perl based on the POE networking and multi-tasking framework for Perl.

Especially of note is Bot-BasicBot which is a layer above POE-Component-IRC that is more user-friendly and straightforward for writing a bot.

Net-Async-IRC

An IRC component for IO::Async.

AnyEvent-IRC

An IRC component for AnyEvent, which is an event system independent IRC protocol module.

For XMPP/Jabber

The following modules can be used to interact with the XMPP / Jabber protocol, which has become popular for instant messaging with such providers as GChat/GTalk, and Facebook.

Chat Clients with support for Perl Scripting

This is a partial list of chat clients which provide support for scripting using Perl:

  1. Pidgin - an open-source, multi-protocol, and cross-platform chat client with support for Perl scripting.

  2. HexChat - an open-source IRC client. Originally based on the older XChat, but is more actively maintained, has a free-of-charge version for all systems, and is now more recommended.

  3. Irssi - a powerful console / terminal client, with support for scripting using Perl, and even integrating nicely with POE, and POE-Component-IRC.

  4. WeeChat - an open source console client with support for scripting in Perl and other languages.

Voice-over-IP (Asterisk/etc.) Support for Perl

TODO : FILL IN

Share/Bookmark

Footer