comparison skillbot.pl @ 45:1d349044c860

Add finish day and time to !eta
author Dominic Cleal <dominic@computerkb.co.uk>
date Fri, 19 Dec 2008 12:46:10 +0000
parents f7abbe853f5d
children bfd2b428d131
comparison
equal deleted inserted replaced
44:f7abbe853f5d 45:1d349044c860
21 use warnings; 21 use warnings;
22 22
23 use WebService::EveOnline; 23 use WebService::EveOnline;
24 use Data::Dumper; 24 use Data::Dumper;
25 use Net::IRC; 25 use Net::IRC;
26 use HTML::Entities;
27 use POSIX; 26 use POSIX;
28 use Encode; 27 use Encode;
28 use DateTime;
29 29
30 require 'timers.pl'; 30 require 'timers.pl';
31 31
32 # Config variables 32 # Config variables
33 my %config; 33 my %config;
236 my $downtime = ''; 236 my $downtime = '';
237 if (skill_finish_in_downtime($f->{skill})) { 237 if (skill_finish_in_downtime($f->{skill})) {
238 $downtime = ", coincides with downtime"; 238 $downtime = ", coincides with downtime";
239 } 239 }
240 240
241 $text = sprintf("Currently training %s %s (finish in %s%s)", 241 my $finish = DateTime->from_epoch(
242 epoch => $f->{skill}->finish_time);
243
244 $text = sprintf("Currently training %s %s ".
245 "(finish in %s, %s%s)",
242 $f->{skill}->name, $f->{skill}->level, 246 $f->{skill}->name, $f->{skill}->level,
243 $f->{skill}->time_remaining, $downtime) 247 $f->{skill}->time_remaining,
248 $finish->strftime("%A %R"), $downtime)
244 } else { 249 } else {
245 $text = "No skill currently training"; 250 $text = "No skill currently training";
246 } 251 }
247 252
248 $self->privmsg('#' . $config{channel}, sprintf( 253 $self->privmsg('#' . $config{channel}, sprintf(