From 512a360694bf9eca4ddaaefc4bf71e8c9573d0d4 Mon Sep 17 00:00:00 2001 From: Alexander NeonXP Kiryukhin Date: Fri, 27 May 2016 15:15:31 +0300 Subject: Fix bug --- src/NeonXP/BotScript.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/NeonXP/BotScript.php b/src/NeonXP/BotScript.php index 0a447bf..5b912c5 100644 --- a/src/NeonXP/BotScript.php +++ b/src/NeonXP/BotScript.php @@ -29,14 +29,15 @@ class BotScript }; $sendCode = function (Message $message, Telegram $telegram) use ($dozorApi) { $code = trim(substr($message->getText(),1)); + $result = false; try { $result = $dozorApi->sendCode($message->getChat(), $code); }catch (\Exception $e) { $telegram->getMethods()->sendMessage($message->getChat(), 'Ошибка сети', true); } - - $telegram->getMethods()->sendMessage($message->getChat(), $result, true); - + if ($result) { + $telegram->getMethods()->sendMessage($message->getChat(), $result, true); + } return State::INITIAL; //Set initial state }; @@ -70,4 +71,4 @@ class BotScript action(new isAnyText(), $pause)-> end(); } -} \ No newline at end of file +} -- cgit v1.2.3