diff --git a/.gitignore b/.gitignore index 01d3b2c..2ac68eb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ aleesa-telegram.pid data/cache/** data/admin/** data/config.json +data/chatlist.txt vendor_perl/** diff --git a/export_settings.pl b/export_settings.pl index d1bcfa4..cb44a84 100644 --- a/export_settings.pl +++ b/export_settings.pl @@ -13,11 +13,31 @@ use warnings; use utf8; use open qw (:std :utf8); use English qw ( -no_match_vars ); + +use version; our $VERSION = qw (1.0); + +my $workdir; + +# before we run, change working dir +BEGIN { + use Cwd qw (chdir abs_path); + my @CWD = split /\//xms, abs_path ($PROGRAM_NAME); + + if ($#CWD > 1) { + $#CWD = $#CWD - 1; + } + + $workdir = join '/', @CWD; + chdir $workdir; +} + +use lib ("$workdir/lib", "$workdir/vendor_perl", "$workdir/vendor_perl/lib/perl5"); +no Cwd; + + use Data::Dumper qw(Dumper); use JSON::XS (); -use lib ("./lib", "./vendor_perl", "./vendor_perl/lib/perl5"); - use BotLib::Admin qw( FortuneToggleList FortuneEnabled ChanMsgToggleList ChanMsgEnabled