Bugfix
This commit is contained in:
parent
824b62cd10
commit
28e236e880
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
namespace danog\MadelineProto\Wrappers;
|
namespace danog\MadelineProto\Wrappers;
|
||||||
|
|
||||||
|
use danog\MadelineProto\Tools;
|
||||||
|
|
||||||
use function Amp\ByteStream\getStdout;
|
use function Amp\ByteStream\getStdout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,7 +34,7 @@ trait ApiStart
|
|||||||
$stdout = getStdout();
|
$stdout = getStdout();
|
||||||
yield $stdout->write('You did not define a valid API ID/API hash. Do you want to define it now manually, or automatically? (m/a)
|
yield $stdout->write('You did not define a valid API ID/API hash. Do you want to define it now manually, or automatically? (m/a)
|
||||||
Note that you can also provide the API parameters directly in the code using the settings: https://docs.madelineproto.xyz/docs/SETTINGS.html#settingsapp_infoapi_id'.PHP_EOL);
|
Note that you can also provide the API parameters directly in the code using the settings: https://docs.madelineproto.xyz/docs/SETTINGS.html#settingsapp_infoapi_id'.PHP_EOL);
|
||||||
if (\strpos(yield $this->readLine('Your choice (m/a): '), 'm') !== false) {
|
if (\strpos(yield Tools::readLine('Your choice (m/a): '), 'm') !== false) {
|
||||||
yield $stdout->write('1) Login to my.telegram.org
|
yield $stdout->write('1) Login to my.telegram.org
|
||||||
2) Go to API development tools
|
2) Go to API development tools
|
||||||
3) App title: your app\'s name, can be anything
|
3) App title: your app\'s name, can be anything
|
||||||
@ -41,19 +43,19 @@ Note that you can also provide the API parameters directly in the code using the
|
|||||||
Platform: anything
|
Platform: anything
|
||||||
Description: Describe your app here
|
Description: Describe your app here
|
||||||
4) Click on create application'.PHP_EOL);
|
4) Click on create application'.PHP_EOL);
|
||||||
$app['api_id'] = yield $this->readLine('5) Enter your API ID: ');
|
$app['api_id'] = yield Tools::readLine('5) Enter your API ID: ');
|
||||||
$app['api_hash'] = yield $this->readLine('6) Enter your API hash: ');
|
$app['api_hash'] = yield Tools::readLine('6) Enter your API hash: ');
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
$this->my_telegram_org_wrapper = new \danog\MadelineProto\MyTelegramOrgWrapper($settings);
|
$this->my_telegram_org_wrapper = new \danog\MadelineProto\MyTelegramOrgWrapper($settings);
|
||||||
yield $this->my_telegram_org_wrapper->login_async(yield $this->readLine('Enter a phone number that is already registered on Telegram: '));
|
yield $this->my_telegram_org_wrapper->login_async(yield Tools::readLine('Enter a phone number that is already registered on Telegram: '));
|
||||||
yield $this->my_telegram_org_wrapper->complete_login_async(yield $this->readLine('Enter the verification code you received in telegram: '));
|
yield $this->my_telegram_org_wrapper->complete_login_async(yield Tools::readLine('Enter the verification code you received in telegram: '));
|
||||||
if (!yield $this->my_telegram_org_wrapper->has_app_async()) {
|
if (!yield $this->my_telegram_org_wrapper->has_app_async()) {
|
||||||
$app_title = yield $this->readLine('Enter the app\'s name, can be anything: ');
|
$app_title = yield Tools::readLine('Enter the app\'s name, can be anything: ');
|
||||||
$short_name = yield $this->readLine('Enter the app\'s short name, can be anything: ');
|
$short_name = yield Tools::readLine('Enter the app\'s short name, can be anything: ');
|
||||||
$url = yield $this->readLine('Enter the app/website\'s URL, or t.me/yourusername: ');
|
$url = yield Tools::readLine('Enter the app/website\'s URL, or t.me/yourusername: ');
|
||||||
$description = yield $this->readLine('Describe your app: ');
|
$description = yield Tools::readLine('Describe your app: ');
|
||||||
$app = yield $this->my_telegram_org_wrapper->create_app_async(['app_title' => $app_title, 'app_shortname' => $short_name, 'app_url' => $url, 'app_platform' => 'web', 'app_desc' => $description]);
|
$app = yield $this->my_telegram_org_wrapper->create_app_async(['app_title' => $app_title, 'app_shortname' => $short_name, 'app_url' => $url, 'app_platform' => 'web', 'app_desc' => $description]);
|
||||||
} else {
|
} else {
|
||||||
$app = yield $this->my_telegram_org_wrapper->get_app_async();
|
$app = yield $this->my_telegram_org_wrapper->get_app_async();
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
namespace danog\MadelineProto\Wrappers;
|
namespace danog\MadelineProto\Wrappers;
|
||||||
|
|
||||||
|
use danog\MadelineProto\Tools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages simple logging in and out.
|
* Manages simple logging in and out.
|
||||||
*/
|
*/
|
||||||
@ -30,16 +32,16 @@ trait Start
|
|||||||
return yield $this->get_self_async();
|
return yield $this->get_self_async();
|
||||||
}
|
}
|
||||||
if (PHP_SAPI === 'cli') {
|
if (PHP_SAPI === 'cli') {
|
||||||
if (\strpos(yield $this->readLine('Do you want to login as user or bot (u/b)? '), 'b') !== false) {
|
if (\strpos(yield Tools::readLine('Do you want to login as user or bot (u/b)? '), 'b') !== false) {
|
||||||
yield $this->bot_login_async(yield $this->readLine('Enter your bot token: '));
|
yield $this->bot_login_async(yield Tools::readLine('Enter your bot token: '));
|
||||||
} else {
|
} else {
|
||||||
yield $this->phone_login_async(yield $this->readLine('Enter your phone number: '));
|
yield $this->phone_login_async(yield Tools::readLine('Enter your phone number: '));
|
||||||
$authorization = yield $this->complete_phone_login_async(yield $this->readLine('Enter the phone code: '));
|
$authorization = yield $this->complete_phone_login_async(yield Tools::readLine('Enter the phone code: '));
|
||||||
if ($authorization['_'] === 'account.password') {
|
if ($authorization['_'] === 'account.password') {
|
||||||
$authorization = yield $this->complete_2fa_login_async(yield $this->readLine('Please enter your password (hint '.$authorization['hint'].'): '));
|
$authorization = yield $this->complete_2fa_login_async(yield Tools::readLine('Please enter your password (hint '.$authorization['hint'].'): '));
|
||||||
}
|
}
|
||||||
if ($authorization['_'] === 'account.needSignup') {
|
if ($authorization['_'] === 'account.needSignup') {
|
||||||
$authorization = yield $this->complete_signup_async(yield $this->readLine('Please enter your first name: '), yield $this->readLine('Please enter your last name (can be empty): '));
|
$authorization = yield $this->complete_signup_async(yield Tools::readLine('Please enter your first name: '), yield Tools::readLine('Please enter your last name (can be empty): '));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->serialize();
|
$this->serialize();
|
||||||
|
Loading…
Reference in New Issue
Block a user