getUpdates() as $update) { if($update->getMessage() !== null && $update->getMessage()->getText() !== null) { print(sprintf("%s: %s", $update->getMessage()->getFrom()->getFirstName(), $update->getMessage()->getText()) . PHP_EOL); $bot->sendMessage($update->getMessage()->getChat()->getId(), sprintf("Hello %s!", $update->getMessage()->getFrom()->getFirstName())); $bot->sendPhoto($update->getMessage()->getChat()->getId(), 'https://git.n64.cc/uploads/-/system/appearance/header_logo/1/9d9bd13afce1a798d22ecfd9897730ed.gif'); } } }