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
Games.pm interfaces a handful of silly games, mapped to commands in a configuration file (usually etc/plugins/games.conf).
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', $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
Jon Portnoy <avenj@cobaltirc.org>
Roulette.pm provided by Schroedingers_hat @ irc.cobaltirc.org
To install Bot::Cobalt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Cobalt
CPAN shell
perl -MCPAN -e shell install Bot::Cobalt
For more information on module installation, please visit the detailed CPAN module installation guide.