The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

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

DESCRIPTION

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

WRITING GAMES

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',
      $msg->context,
      $msg->channel,
      $some_response
    );
    return
  }

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

See Bot::Cobalt::Manual::Plugins

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>

Roulette.pm provided by Schroedingers_hat @ irc.cobaltirc.org