fix(app): fix unhandled exceptions
This commit is contained in:
@@ -48,6 +48,11 @@ class TelegramHandler
|
|||||||
public function webhook(Request $request): JsonResponse
|
public function webhook(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$update = $request->json();
|
$update = $request->json();
|
||||||
|
$message = $update['message'] ?? null;
|
||||||
|
if (! $message) {
|
||||||
|
return new JsonResponse([]);
|
||||||
|
}
|
||||||
|
|
||||||
$userId = $update['message']['from']['id'];
|
$userId = $update['message']['from']['id'];
|
||||||
$chatId = $update['message']['chat']['id'];
|
$chatId = $update['message']['chat']['id'];
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ MARKDOWN
|
|||||||
$step = $state['data']['step'];
|
$step = $state['data']['step'];
|
||||||
|
|
||||||
if ($step === 'message_text') {
|
if ($step === 'message_text') {
|
||||||
$message = $update['message']['text'];
|
$message = Arr::get($update, 'message.text', 'Недопустимый текст сообщения');
|
||||||
$state['data']['data']['message_text'] = $message;
|
$state['data']['data']['message_text'] = $message;
|
||||||
$state['data']['step'] = 'btn_text';
|
$state['data']['step'] = 'btn_text';
|
||||||
$this->state->setState(self::class, $userId, $chatId, $state['data']);
|
$this->state->setState(self::class, $userId, $chatId, $state['data']);
|
||||||
|
|||||||
Reference in New Issue
Block a user