php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.9k stars 955 forks source link

Fatal error: Call to undefined method Longman\TelegramBot\Telegram::deleteWebhook() #429

Closed behnamazimi closed 7 years ago

behnamazimi commented 7 years ago

I just simply set webhook, and now when I want to unset it this error appears!

I also faced the below error in set wobhook and callingisOk()method. Fatal error: Call to a member function isOk() on string And I ignore it by removing the line that call isOk() method of $result.

That's my unset.php:

<?php
require 'vendor/autoload.php';

$API_KEY = 'myToken';
$BOT_NAME = 'bot_name';
try {
    $telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);

    $result = $telegram->deleteWebhook();

    echo $result;
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
    echo $e;
}
noplanman commented 7 years ago

Hi @behnamazimi

What version of the library are you on, what PHP version, etc.?

Also, what does your echo $result; output?

behnamazimi commented 7 years ago

Hi @noplanman, How can I get the library version? I clone it from this repository in last two days. According to Telegram.php file, I guess that version is 0.0.5. Am I true?

And I use PHP 5.6. And also yes, echo $result is just for output.

noplanman commented 7 years ago

How did you get that version?!

The latest is 0.40.1. Best way to install the library is via composer: composer require longman/telegram-bot

That should get the latest one. Call composer update afterwards to be sure.

behnamazimi commented 7 years ago

Thank You @noplanman 😊 This error happened because I used new version methods in old version library.