#!/usr/bin/perl -w package Bot::Dice; use strict; use warnings; use base qw(Bot::BasicBot); sub said { my ($self, $args) = @_; my $nick = $self->nick; if( $args->{body} =~ /roll( (\d))?/ && $args->{address}) { my $dices = $2 || 1; my @dice; for(1..$dices){ push @dice, int (rand 6 )+ 1; } return join ',', @dice; } undef; } # bot identity # with all known options my $bot = Bot::Dice->new( server => "irc.deoxy.org", port => "6667", channels => ["#chat"], nick => "DiceBot", alt_nicks => ["DiceBot_", "DiceBot__"], username => "DiceBot", name => "DiceBot", ); $bot->run();