summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games.pm
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2008-12-20 03:23:26 -0500
committerdoy <doy@tozt.net>2008-12-20 03:23:26 -0500
commitc7e51b0c38746f568e60b655a737fc19ef8ba0fa (patch)
tree5ada4e621ebd47b82ee811b1f009fc1c8e9ffdf6 /lib/Bot/Games.pm
parent5956d7071997e127c86362076a62da7f4ac18b0b (diff)
downloadbot-games-c7e51b0c38746f568e60b655a737fc19ef8ba0fa.tar.gz
bot-games-c7e51b0c38746f568e60b655a737fc19ef8ba0fa.zip
don't call _init if it doesn't exist
Diffstat (limited to 'lib/Bot/Games.pm')
-rw-r--r--lib/Bot/Games.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Bot/Games.pm b/lib/Bot/Games.pm
index 36b47ef..54fc813 100644
--- a/lib/Bot/Games.pm
+++ b/lib/Bot/Games.pm
@@ -42,18 +42,19 @@ sub said {
my ($game_name, $action) = ($1, $2);
return unless $self->valid_game($game_name);
+ my $output;
my $game = $self->active_games->{$game_name};
if (!defined $game || !defined $action) {
$game = $self->game_package($game_name)->new;
$self->active_games->{$game_name} = $game;
- my $output = $game->_init($args->{who});
+ $output = $game->_init($args->{who})
+ if $game->can('_init');
$self->say(%$args, body => $self->_format($output))
if defined $output;
}
return unless defined $action;
- my $output;
if ($action =~ /^-(\w+)\s*(.*)/) {
my ($action, $arg) = ($1, $2);
if ($action =~ s/^_//) {