电报用MADELINEPROTO库

2024-09-30 06:26:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个项目,我需要使用Madelineproto库要求。什么时候我运行的例子那个。phpstorm给我一些警告方法说他们不存在例如电话登录,给我一些错误。 我的代码是:

<?php set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto‌Bot/')); require 'MadelineProtoBot\MadelineProto\vendor\autoload.php'; $settings = ['app_info' => ['api_id' => ,... 'api_hash' => '...']]; $MadelineProto = new danog\MadelineProto\API($settings); $MadelineProto->phone_login(readline('my phone ')); $authorization = $MadelineProto->complete_phone_login(readline('Enter the code you received: ')); if ($authorization['_'] === 'account.noPassword') { throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); } if ($authorization['_'] === 'account.password') { $authorization = $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); } if ($authorization['_'] === 'account.needSignup') { $authorization = $MadelineProto->complete_signup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); }

我的错误是:

我该怎么办???


Tags: yourreadlineif错误loginphoneaccountpassword
1条回答
网友
1楼 · 发布于 2024-09-30 06:26:11

用这个来模拟它

if (!function_exists("readline")) {
    function readline($prompt = null){
        if ($prompt) {
            echo $prompt;
        }
        $fp = fopen("php://stdin","r");
        $line = rtrim(fgets($fp, 1024));
        return $line;
    }
}

你可以参考其他问题:Call to undefined function readline

相关问题 更多 >

    热门问题