Jon Portnoy


Bot::Cobalt::Plugin::Games - Some silly IRC games


  !roll 2d6    -- Dice roller
  !rps <throw> -- Rock, paper, scissors
  !magic8      -- Ask the Magic 8-ball
  !rr          -- Russian Roulette

DESCRIPTION interfaces a handful of silly games, mapped to commands in a configuration file (usually etc/plugins/games.conf).


On the backend, commands specified in our config are mapped to modules that are automatically loaded when this plugin is.

When the specified command is handled, the game module's execute method is called and passed the original message hash (as specified in "Bot_public_msg" in Bot::Cobalt::IRC) and the stripped string without the command:

  use Bot::Cobalt;
  sub execute {
    my ($self, $msg, $str) = @_;

    my $src_nick = $msg->src_nick;

    . . .

    ## We can return a response to the channel:
    return $some_response;

    ## ...or send a message and return nothing:
    broadcast( 'message',

For more complicated games, you may want to write a stand-alone plugin.

See Bot::Cobalt::Manual::Plugins


Jon Portnoy <> provided by Schroedingers_hat @