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

Не работает #3

Open
jenokizm opened this issue Jul 1, 2019 · 1 comment
Open

Не работает #3

jenokizm opened this issue Jul 1, 2019 · 1 comment

Comments

@jenokizm
Copy link

jenokizm commented Jul 1, 2019

php 7.1 + api lib 2.3.13
этот код этого репозитория невыполняется.
Либо выдает исключение Syntax error либо тупо пых жалуется что sendMessage() нет такого метода у \TelegramBot\Api\Client

@sslion
Copy link

sslion commented Oct 11, 2021

` /**
* JSON validation
*
* @param string $jsonString
* @param boolean $asArray
*
* @return object|array
* @throws \TelegramBot\Api\InvalidJsonException
*/
public static function jsonValidate($jsonString, $asArray)
{
if(!$jsonString) $jsonString = "{}"; // <--- add this line

    $json = json_decode($jsonString, $asArray);

    if (json_last_error() != JSON_ERROR_NONE) {
        throw new InvalidJsonException(json_last_error_msg(), json_last_error());
    }

    return $json;
}`

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

3 participants
@jenokizm @sslion and others