Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram error (Plugin) #8

Open
thiavs opened this issue Jan 7, 2019 · 1 comment
Open

Telegram error (Plugin) #8

thiavs opened this issue Jan 7, 2019 · 1 comment

Comments

@thiavs
Copy link

thiavs commented Jan 7, 2019

Someone could help me?

I'm having a problem with the telegram after upgrading from moodle version 3.2 to 3.5.

moodle debbug displays the following error:

Notice: Trying to get property of non-object in / folder path / message / output / telegram / classes / manager.php on line 198

the function is this:

public function update_bot_info() {

    if (empty($this->config('sitebottoken'))) {

        return false;

    } else {

        $response = $this->send_api_command('getMe');

        if ($response->ok) {

            $this->set_config('sitebotname', $response->result->first_name);

            $this->set_config('sitebotusername', $response->result->username);

            return true;

        } else {

            return false;

        }

    }

}

Line 198 is:

if ($response->ok) {

@bobrov-ivan
Copy link

To fix the issue it is necessary to fix send_api_command function - to add options to curl->get call:

    return json_decode($this->curl->get('https://api.telegram.org/bot'.$this->config('sitebottoken').'/'.$command, $params, ["CURLOPT_RETURNTRANSFER" => true]));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants