| IRC-Bot-Hangman documentation | Contained in the IRC-Bot-Hangman distribution. |
IRC::Bot::Hangman::Command::Default - Default hangman commands
See IRC::Bot::Hangman
This module is a plugin providing the implementation of the basics hangman commands.
<letter>? : guess a letter guess <letter> : guess a letter guess <word> : guess an entire word <hangman> help - help instructions <hangman> play : Start a new game or display current game <hangman> quiet : keep quite between guesses <hangman> talk : Talk between guesses
This plugin's name = 'default'
Commands provided by this plugin:
play quiet talk
Pierre Denis <pierre@itrelease.net>
http://www.itrelease.net/
Copyright 2005 IT Release Ltd - All Rights Reserved.
This module is released under the same license as Perl itself.
| IRC-Bot-Hangman documentation | Contained in the IRC-Bot-Hangman distribution. |
package IRC::Bot::Hangman::Command::Default; use warnings::register; use strict; use Data::Dumper; use Carp qw( carp );
sub name () { 'default' }
sub commands () { return { play => \&play, quiet => \&quiet, talk => \&talk, }; }
sub play { my $robot = shift; if ($robot->game->lost or $robot->game->won) { $robot->new_game(); return; } else { $robot->response( $robot->msg_guess() ); } }
sub quiet { my $robot = shift; $robot->can_talk(0); $robot->response( $robot->get_a_msg('quiet') ); }
sub talk { my $robot = shift; $robot->can_talk(1); $robot->response( $robot->get_a_msg('talk') ); } 1;