setWebhook() public static method

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