Skip to content

Commit

Permalink
fix error while wait for code
Browse files Browse the repository at this point in the history
  • Loading branch information
dogwong authored and nodegin committed Mar 24, 2020
1 parent 8d4a890 commit 0b9679a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tglib",
"version": "3.0.4",
"version": "3.0.5",
"author": "nodegin",
"license": "MIT",
"description": "TDLib (Telegram Database library) bindings for Node.js",
Expand Down
15 changes: 9 additions & 6 deletions src/ClientBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,21 @@ class Client {
}
case 'authorizationStateWaitCode': {
const payload = { '@type': 'checkAuthenticationCode' }
if (!update['authorization_state']['is_registered']) {
console.log(`User ${value} has not yet been registered with Telegram`)
payload['first_name'] = await this.callbacks['td:getInput']({
string: 'tglib.input.FirstName',
})
}
payload['code'] = await this.callbacks['td:getInput']({
string: 'tglib.input.AuthorizationCode',
})
this._send(payload)
break
}
case 'authorizationStateWaitRegistration': {
const payload = { '@type': 'registerUser' };
console.log(`User has not yet been registered with Telegram`);
payload['first_name'] = await this.callbacks['td:getInput']({
string: 'tglib.input.FirstName',
});
this._send(payload);
break
}
case 'authorizationStateWaitPassword': {
this.authFlowPasswordHint = update['authorization_state']['password_hint']
const password = await this.callbacks['td:getInput']({
Expand Down

0 comments on commit 0b9679a

Please sign in to comment.