Compare commits
3 Commits
b9c88ad4e7
...
4f9675f1d2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f9675f1d2 | ||
|
|
1667772268 | ||
|
|
ebaf2c9b38 |
@@ -193,6 +193,10 @@ sub __fork {
|
||||
sub __signal_handler {
|
||||
$log->info ("[INFO] Caught a signal $OS_ERROR");
|
||||
|
||||
eval {
|
||||
$main::TGM->logOut();
|
||||
};
|
||||
|
||||
if (-e $pidfile) {
|
||||
unlink $pidfile;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ use English qw ( -no_match_vars );
|
||||
|
||||
use Clone qw (clone);
|
||||
use Data::Dumper qw (Dumper);
|
||||
use JSON::PP ();
|
||||
use Log::Any qw ($log);
|
||||
use Math::Random::Secure qw (irand);
|
||||
|
||||
|
||||
@@ -958,6 +958,23 @@ sub _post_request {
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub logOut {
|
||||
my $self = shift;
|
||||
|
||||
my $send_args = {};
|
||||
my $ret;
|
||||
|
||||
if (! defined($self->token) || $self->token eq '') {
|
||||
$ret->{error} = 1;
|
||||
$ret->{message} = 'No token supplied to logOut()';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
my $url = sprintf 'https://api.telegram.org/bot%s/logOut', $self->token;
|
||||
|
||||
return $self->_post_request($url, $send_args);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user