Compare commits
3 Commits
04057e10e1
...
ab27431e83
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab27431e83 | ||
|
|
d53ee53ad8 | ||
|
|
9461042ec4 |
10
README.md
10
README.md
@@ -12,8 +12,8 @@ Bot can be run via **bin/aleesa-telegam-bot** and acts as daemon.
|
||||
|
||||
## Installation
|
||||
|
||||
In order to run this application, you need to "bootstrap" it - download all
|
||||
dependencies and libraries.
|
||||
In order to run this application, you need to "bootstrap" it - download and build
|
||||
all required dependencies and libraries.
|
||||
|
||||
You'll need "Development Tools" or similar group of packages, perl, perl-devel,
|
||||
perl-local-lib, perl-app-cpanm, sqlite-devel, zlib-devel, openssl-devel,
|
||||
@@ -25,12 +25,12 @@ After installng required dependencies it is possible to run:
|
||||
bash bootstrap.sh
|
||||
```
|
||||
|
||||
and all libraries should be downloaded and built.
|
||||
and all libraries should be downloaded, built, tested and installed.
|
||||
|
||||
## N.B.
|
||||
|
||||
If bot is unable to post to channel due to limitated permissions, it will die.
|
||||
It if possible to change this behavior by patching Telegram/Bot/Brain.pm:
|
||||
If bot is unable to post to channel due to limited permissions, it will die.
|
||||
It is possible to change this behavior by patching Telegram/Bot/Brain.pm:
|
||||
|
||||
```diff
|
||||
--- Brain.pm 2019-07-01 04:04:17.000000000 +0300
|
||||
|
||||
@@ -18,6 +18,8 @@ BEGIN {
|
||||
}
|
||||
|
||||
use lib ("$workdir/lib", "$workdir/vendor_perl", "$workdir/vendor_perl/lib/perl5");
|
||||
no Cwd;
|
||||
use Cwd::utf8 qw(chdir abs_path);
|
||||
use POSIX qw(setgid setuid setsid);
|
||||
use File::Path qw(make_path);
|
||||
use File::Basename qw(basename dirname);
|
||||
@@ -70,8 +72,13 @@ if ($< == 0) {
|
||||
# double fork attach to /dev/null all stdio and go background
|
||||
daemonize ();
|
||||
|
||||
unless (defined($apath)) {
|
||||
logger ("Unable to get abs_path: $!");
|
||||
die "Unable to get abs_path: $!\n";
|
||||
};
|
||||
|
||||
# write pidfile
|
||||
my $pidfile = sprintf ("%s/%s.pid", $piddir, basename (abs_path ($0)));
|
||||
my $pidfile = sprintf ("%s/%s.pid", $piddir, basename ($apath));
|
||||
logger ("Creating pidfile at $pidfile");
|
||||
open (PID, ">", $pidfile) or die "Error opening $pidfile: $!\n";
|
||||
print PID $$ or die "Error writing to $pidfile: $!\n";
|
||||
|
||||
11
cpanfile
11
cpanfile
@@ -1,14 +1,15 @@
|
||||
requires 'local::lib';
|
||||
requires 'JSON';
|
||||
requires 'Hailo';
|
||||
requires 'Telegram::Bot';
|
||||
requires 'Cwd::utf8';
|
||||
requires 'DB_File';
|
||||
requires 'Digest::MD5';
|
||||
requires 'Encode';
|
||||
requires 'File::Path';
|
||||
requires 'File::Basename';
|
||||
requires 'File::Path';
|
||||
requires 'HTTP::Tiny';
|
||||
requires 'Hailo';
|
||||
requires 'JSON';
|
||||
requires 'JSON::XS';
|
||||
requires 'JSON::PP';
|
||||
requires 'Mojo::Base';
|
||||
requires 'Telegram::Bot';
|
||||
requires 'URI::URL';
|
||||
requires 'local::lib';
|
||||
|
||||
@@ -25,8 +25,7 @@ my $c = loadConf();
|
||||
|
||||
sub weather($) {
|
||||
my $city = shift;
|
||||
while (substr($city, -1) eq "\n") { chomp($city); }
|
||||
while (substr($city, 0, 1) eq "\n") { $city = substr($city, 1); }
|
||||
$city = trim($city);
|
||||
|
||||
return "Мне нужно ИМЯ города." if ($city eq '');
|
||||
return "Длинновато для названия города." if (length($city) > 80);
|
||||
|
||||
Reference in New Issue
Block a user