Set webhook
public static setWebhook ( string $url = '', string $file = null ) : |
||
$url | string | |
$file | string | |
return |
/** * Set Webhook for bot * * @return string */ public function setWebHook($url) { if (empty($url)) { throw new TelegramException('Hook url is empty!'); } $result = Request::setWebhook($url); if (!$result['ok']) { throw new TelegramException('Webhook was not set! Error: ' . $result['description']); } return $result['description']; }
/** * Unset Webhook for bot * * @return \Longman\TelegramBot\Entities\ServerResponse */ public function unsetWebHook() { $result = Request::setWebhook(); if (!$result->isOk()) { throw new TelegramException('Webhook was not unset! Error: ' . $result->getErrorCode() . ' ' . $result->getDescription()); } return $result; }
/** * Set Webhook for bot * * @return string */ public function setWebHook($url, $path_certificate = null) { if (empty($url)) { throw new TelegramException('Hook url is empty!'); } $result = Request::setWebhook($url, $path_certificate); if (!$result->isOk()) { throw new TelegramException('Webhook was not set! Error: ' . $result->getErrorCode() . ' ' . $result->getDescription()); } return $result; }