Updated method \TgBotLib > Bot > handleGetUpdates() to handle exceptions

This commit is contained in:
Netkas 2023-08-09 20:02:59 -04:00
parent 8a4dfddae6
commit fbc472d8de
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
6 changed files with 21 additions and 27 deletions

View file

@ -18,9 +18,9 @@
public function handle(Bot $bot, Update $update): void
{
// Usage: /hash <text>
$data = str_replace('/hash ', '', $update->getMessage()->getText());
$data = str_replace('/hash ', '', $update->getMessage()?->getText());
$bot->sendMessage(
$update->getMessage()->getChat()->getId(), md5($data)
$update->getMessage()?->getChat()?->getId(), md5($data)
);
}
}

View file

@ -19,7 +19,7 @@
{
// reply to the incoming message
$bot->sendMessage(
$update->getMessage()->getChat()->getId(), 'Hello, ' . $update->getMessage()->getFrom()->getFirstName()
$update->getMessage()?->getChat()?->getId(), 'Hello, ' . $update->getMessage()?->getFrom()?->getFirstName()
);
}
}