Move !ping to redis rails

This commit is contained in:
eleksir
2021-12-19 14:42:23 +03:00
parent e74a3e46c1
commit 1d287f853f
7 changed files with 85 additions and 40 deletions

View File

@@ -15,11 +15,24 @@ our @EXPORT_OK = qw (redis_parse_message);
sub redis_parse_message {
my $self = shift;
my $m = shift;
my $answer = $m;
my $send_to = $answer->{from};
$log->error (Dumper $self);
# We cannot send message if we're not connected to telegram
# TODO: Queue messages properly.
until (defined $main::TGM) {
sleep 1;
}
# TODO: add some checks, at least that the bot is not muted in chat
$main::TGM->sendMessage (
{
chat_id => $m->{chatid},
text => $m->{message}
}
);
return;
};