Mercurial > hg > skillbot
comparison skillbot.pl @ 62:f620582dee33
Reverting changeset c5ce2fff9b85, buggy
author | Dominic Cleal <dominic@computerkb.co.uk> |
---|---|
date | Thu, 01 Jan 2009 11:20:10 +0000 |
parents | 2328f73e25a8 |
children | 27f9196fd610 |
comparison
equal
deleted
inserted
replaced
61:2328f73e25a8 | 62:f620582dee33 |
---|---|
60 print PIDFILE "$$\n"; | 60 print PIDFILE "$$\n"; |
61 close(PIDFILE) or die "can't close $config{'pidfile'}: $!"; | 61 close(PIDFILE) or die "can't close $config{'pidfile'}: $!"; |
62 | 62 |
63 my $irc = new Net::IRC; | 63 my $irc = new Net::IRC; |
64 | 64 |
65 update_friends($irc); | 65 update_friends(undef); |
66 | 66 |
67 my $conn = $irc->newconn(Server => $config{'target_server'}, | 67 my $conn = $irc->newconn(Server => $config{'target_server'}, |
68 Port => $config{'target_port'}, | 68 Port => $config{'target_port'}, |
69 Nick => $config{'nick'}, | 69 Nick => $config{'nick'}, |
70 Ircname => $ircname, | 70 Ircname => $ircname, |
178 sub on_join | 178 sub on_join |
179 { | 179 { |
180 my ($self, $event) = @_; | 180 my ($self, $event) = @_; |
181 | 181 |
182 # print Dumper($event); | 182 # print Dumper($event); |
183 # if ($event->nick eq $config{nick}) { | 183 if ($event->nick eq $config{nick}) { |
184 # } | 184 =pod |
185 $twit->update("In channel, checking for tweets"); | |
186 $twit->http_code == 200 or print sprintf("%s| *** %s\n", scalar gmtime(), $twit->http_message); | |
187 =cut | |
188 | |
189 # Now we're in, check for tweets as a one-off | |
190 add_one_shot_timer(10, sub { my ($timer, $self) = @_; check_training($self); }); | |
191 } | |
185 } | 192 } |
186 | 193 |
187 sub on_ping | 194 sub on_ping |
188 { | 195 { |
189 my ($self, $event) = @_; | 196 my ($self, $event) = @_; |
433 api_key => $key } ); | 440 api_key => $key } ); |
434 | 441 |
435 my $loaded = 0; | 442 my $loaded = 0; |
436 foreach my $character ($api->characters) { | 443 foreach my $character ($api->characters) { |
437 next if defined $c && $c ne $character->name; | 444 next if defined $c && $c ne $character->name; |
438 my $f = { | 445 push @friends, { |
439 char_api => $character, | 446 char_api => $character, |
440 char => $character->name, | 447 char => $character->name, |
441 api => $api, | 448 api => $api, |
442 nick => $nick, | 449 nick => $nick, |
443 tz => $tz | 450 tz => $tz |
444 }; | 451 }; |
445 push @friends, $f; | |
446 check_friend($self, $f); | |
447 $loaded++; | 452 $loaded++; |
448 } | 453 } |
449 | 454 |
450 if (defined $c && $loaded eq 0) | 455 if (defined $c && $loaded eq 0) |
451 { | 456 { |