Compare commits
No commits in common. "ed510c0635e119478d9a70fd7e0468f66ca14e23" and "27143c691f86ef14c12dcab80790499f393d99e7" have entirely different histories.
ed510c0635
...
27143c691f
17
F1DataBot.pm
17
F1DataBot.pm
@ -1,5 +1,5 @@
|
|||||||
# Important for switch feature
|
# Important for switch feature
|
||||||
use v5.32;
|
use v5.34;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
||||||
@ -13,7 +13,6 @@ use Encode;
|
|||||||
# CPAN packages
|
# CPAN packages
|
||||||
use JSON;
|
use JSON;
|
||||||
use Log::Log4perl;
|
use Log::Log4perl;
|
||||||
use YAML;
|
|
||||||
|
|
||||||
# Package name
|
# Package name
|
||||||
package F1DataBot;
|
package F1DataBot;
|
||||||
@ -37,9 +36,6 @@ sub new {
|
|||||||
Telegram => 'https://api.telegram.org',
|
Telegram => 'https://api.telegram.org',
|
||||||
};
|
};
|
||||||
|
|
||||||
# load remembered update ids
|
|
||||||
$Self->{UpdateIDs} = YAML::LoadFile('update_ids.yml');
|
|
||||||
|
|
||||||
return $Self;
|
return $Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,20 +386,11 @@ sub fetchMessages {
|
|||||||
my @Messages = $MessageDataRaw->{result}->@*;
|
my @Messages = $MessageDataRaw->{result}->@*;
|
||||||
$Self->{LogObject}
|
$Self->{LogObject}
|
||||||
->info( 'fetchMessages: Messages returned are ' . Dumper( \@Messages ) );
|
->info( 'fetchMessages: Messages returned are ' . Dumper( \@Messages ) );
|
||||||
|
|
||||||
MESSAGE:
|
|
||||||
for my $Message (@Messages) {
|
for my $Message (@Messages) {
|
||||||
$Self->{LogObject}->info('fetchMessages: Calling processMessage');
|
$Self->{LogObject}->info('fetchMessages: Calling processMessage');
|
||||||
if ($Self->{UpdateIDs}{$Message->{update_id}}) {
|
|
||||||
$Self->{LogObject}->info('fetchMessages: Skipping known update_id');
|
|
||||||
next MESSAGE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$Self->{UpdateIDs}{$Message->{update_id}} = 1;
|
|
||||||
$Self->processMessage( Message => $Message, );
|
$Self->processMessage( Message => $Message, );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
YAML::DumpFile('update_ids.yml', $Self->{UpdateIDs});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#/usr/bin/perl
|
#/usr/bin/perl
|
||||||
|
|
||||||
use v5.32;
|
use v5.34;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
Loading…
Reference in New Issue
Block a user