issue-1-config_file #3
@ -9,6 +9,7 @@ no warnings qw(experimental);
|
||||
|
||||
# core packages
|
||||
use Encode;
|
||||
use FindBin;
|
||||
|
||||
# CPAN packages
|
||||
use JSON;
|
||||
@ -19,7 +20,7 @@ use YAML;
|
||||
package F1DataBot;
|
||||
|
||||
# Constants and initalisations
|
||||
Log::Log4perl->init('log.conf');
|
||||
Log::Log4perl->init("$FindBin::Bin/log.conf");
|
||||
|
||||
sub new {
|
||||
my ( $Type, %Param ) = @_;
|
||||
@ -38,7 +39,7 @@ sub new {
|
||||
};
|
||||
|
||||
# load remembered update ids
|
||||
$Self->{MessageIDs} = YAML::LoadFile('message_ids.yml');
|
||||
$Self->{MessageIDs} = YAML::LoadFile("$FindBin::Bin/message_ids.yml");
|
||||
|
||||
return $Self;
|
||||
}
|
||||
|
@ -5,9 +5,22 @@ use v5.32;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '/home/demiguise/telegram_bot';
|
||||
use FindBin;
|
||||
use YAML;
|
||||
|
||||
my $Conf;
|
||||
BEGIN { $Conf = YAML::LoadFile("$FindBin::Bin/.f1bot.cnf"); }
|
||||
|
||||
if ( !$Conf->%* ) {
|
||||
print STDERR "No valid config was found. Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
use lib $Conf->{Lib};
|
||||
|
||||
use F1DataBot;
|
||||
|
||||
my $F1DataBotObject = F1DataBot->new();
|
||||
my $F1DataBotObject = F1DataBot->new($Conf->%*);
|
||||
$F1DataBotObject->fetchMessages();
|
||||
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user