summaryrefslogtreecommitdiff
path: root/src/NeonXP
diff options
context:
space:
mode:
authorAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-05-27 15:15:31 +0300
committerAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-05-27 15:15:31 +0300
commit512a360694bf9eca4ddaaefc4bf71e8c9573d0d4 (patch)
tree1af07f8ff80fcdceb1686ccc92fdb64e2e48f49b /src/NeonXP
parentc1861feac82e438e4a070a39b6ebbf712101416b (diff)
Fix bug
Diffstat (limited to 'src/NeonXP')
-rw-r--r--src/NeonXP/BotScript.php9
1 files changed, 5 insertions, 4 deletions
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
+}