From c9b46cc6f01e1881965575a3fcb327e823d757ad Mon Sep 17 00:00:00 2001 From: eleksir Date: Wed, 28 Oct 2020 16:25:54 +0300 Subject: [PATCH] Use sendChatAction() correctly --- lib/telegrambot.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/telegrambot.pm b/lib/telegrambot.pm index 68a7fe4..38aae22 100644 --- a/lib/telegrambot.pm +++ b/lib/telegrambot.pm @@ -162,10 +162,10 @@ sub __on_msg { } # let's emulate real human and delay answer - sleep (int ( rand (3) + 1)); + sleep (int ( rand (2) + 1)); for (0..(4 + int (rand (3)))) { - sendChatAction($chatid); + sendChatAction ($self, $chatid); sleep(3); sleep 3 unless ($_); } @@ -242,6 +242,8 @@ sub __on_msg { } } + sendChatAction ($self, $chatid); + sleep 1; logger sprintf ("Private chat bot reply to $vis_a_vi: %s", $reply); $msg->reply ($reply); # group chat @@ -383,6 +385,7 @@ MYHELP $reply = randomCommonPhrase(); } + sendChatAction ($self, $chatid); sleep (int (rand (2))); logger sprintf ('In public chat %s (%s) bot reply to %s: %s', $chatname, $chatid, $vis_a_vi, $reply); $msg->reply ($reply);