setWebhook() public static method

Set webhook
public static setWebhook ( string $url = '', string $file = null ) : ServerResponse
$url string
$file string
return Longman\TelegramBot\Entities\ServerResponse
Beispiel #1
0
 /**
  * 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;
 }