comparison skillbot.pl @ 8:cb6e21f2d514

Fixing re-check after skill completion
author Dominic Cleal <dominic@computerkb.co.uk>
date Sat, 06 Dec 2008 15:13:07 +0000
parents 6b73a2781c15
children c797330cd371
comparison
equal deleted inserted replaced
7:6b73a2781c15 8:cb6e21f2d514
133 133
134 # Read the "friends" config file every 6 minutes and make sure we have 134 # Read the "friends" config file every 6 minutes and make sure we have
135 # API sessions for them all 135 # API sessions for them all
136 add_repeat_timer(360, sub { my ($timer, $self) = @_; update_friends($self); }); 136 add_repeat_timer(360, sub { my ($timer, $self) = @_; update_friends($self); });
137 137
138 # Check for new skills every 5 minutes. 138 # Check for new skills every 30 minutes.
139 add_repeat_timer(300, sub { my ($timer, $self) = @_; check_training($self); }); 139 add_repeat_timer(1800, sub { my ($timer, $self) = @_; check_training($self); });
140 } 140 }
141 141
142 sub nickserv_id_now 142 sub nickserv_id_now
143 { 143 {
144 my ($self) = shift; 144 my ($self) = shift;
410 410
411 if ($text =~ /[\n\r]/) { 411 if ($text =~ /[\n\r]/) {
412 $text =~ s/[\n\r]/ /g; 412 $text =~ s/[\n\r]/ /g;
413 } 413 }
414 414
415 irc_debug("In %lu seconds, announcing: %s", $skill->finish_time - time(), $text);
416 add_one_shot_timer($skill->finish_time - time(), sub { 415 add_one_shot_timer($skill->finish_time - time(), sub {
417 $self->notice('#' . $config{channel}, sprintf("[%s] %s", 416 $self->notice('#' . $config{channel}, sprintf("[%s] %s",
418 $friends{$f}->{nick}, encode("utf8", $text))); 417 $friends{$f}->{nick}, encode("utf8", $text)));
418 delete $friends{$f}->{skill};
419 }); 419 });
420 } 420 }
421 } 421 }
422 422
423 END { 423 END {