diff options
-rw-r--r-- | Avalon.pm | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -7,9 +7,28 @@ use strict; use warnings; use v5.12; use experimental qw(switch); +use POE; +use Time::HiRes qw(time); use base qw(Bot::BasicBot::Pluggable::Module); +### Game logic ############################################################### +sub set_timeout { + my ( $self, $value) = @_; + $poe_kernel->alarm( avalon_timeout => time() + $value ); +} + +sub timeout_occurred { + my $self = shift; + $self->say( channel => $self->{avalon}->{config}->{'game.channel'}, body => "timeout" ); +} + +### IRC methods override ###################################################### +sub connected { + my $self = shift; + $poe_kernel->state( 'avalon_timeout', $self, 'timeout_occurred' ); +} + sub init { my $self = shift; $self->{avalon} = {}; |