Skip to content
A simple and easy to use IRC Bot framework for Perl 6
  1. Other 100.0%
Branch: master
Clone or download

Latest commit

Timbus Merge pull request #19 from zoffixznet/patch-1
Use modern META filename
Latest commit cfc0041 Apr 27, 2017


Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/Net/IRC Allow for command collisions in the same module Jun 8, 2016 Add some ACME classes to show use of prefix for commands Dec 27, 2013
LICENSE Update LICENSE Nov 4, 2015
META6.json Use modern META filename Apr 25, 2017
README.pod Documentation fixes. Props to MattOates++ Sep 28, 2012



Elegant. Simple. Probably compiles.


use Net::IRC::Bot;
use Net::IRC::Modules::Autoident;

#Roles can let you break up large event handler modules into smaller ones.
role ExtraAnnoying {
    has %enemies = ('bob', 'sam', 'chanserv') X=> 1;
    #Magical type constraints only let this event be called when $e.who is an enemy
    multi method said ($e where {.who<nick> ~~ %enemies}) {
        $e.msg($e.what); #Parrot back what was said;

class AnnoyUsers does ExtraAnnoying {
    #Will be called when the bot gets a join event
    multi method joined ($e) {
         $e.msg("Hi there, {$e.who<nick>}!"); 
        nick     => 'KickMe',
        server   => '',
        channels => <#bottest>,
        modules  => (
       => 'nspassw0rd')


Its an IRC Bot framework! Theres not much else to it. It's currently in active development, but it is mostly stable until perl 6 implements either threads or async I/O so it can work correctly as a bot (timed events and things that block the runtime are not possible yet.)

The framework makes extensive use of the added features perl 6 provides, and is an excellent example of how concise and powerful the language is... With emphasis on concise:- The core code is only about 350 lines!

Methods and Attributes

Net::IRC::Bot only really has one needed method: run(). Everything else is setup using parameters to new()

List of attributes + their defaults:

$nick = "Rakudobot";
@altnicks = $nick Z~ ("_","__",^10);
$username = "Clunky";
$realname = '$@%# yeah, perl 6!';

$server = "";
$port = 6667;
@channels = [];


$debug = False;


Callbacks are event handlers created by you, the bot maker. They are dispatched to by name when an appropriate IRC event is fired.

There are currently six 'main' types of events: said, acted, joined, noticed, nickchanged and connected. They will be called with a Net::IRC::Event object containing every detail possible about the event. [Details to come soon]

For any event that doesn't fit into the above category, you will need to set up a raw event handler. Raw handlers begin with 'irc_' and won't have their Event objects properly filled [TODO: List what will be filled] The method irc_433 for example, will be called when ERR_NICKNAMEINUSE is thrown. irc_privmsg will be just like said, except it will be called first.

Untidy collection of event object contents for each handler:

said: .who said .what in channel .where (if it was a private message, .where will be our nickname. If you dont want to check .state<nick\> for equality then you can always test if .where starts with a hash)

nickchange: .who changed nick to .what

Helper methods

Helper methods are kept in the Event that every callback is provided with. The current three methods are .msg, .act and .send_ctcp. [details on each to come soon]

You can’t perform that action at this time.