refactor(client): use _saveStorage instead of storage.save

This commit is contained in:
teidesu 2021-04-17 19:00:46 +03:00
parent 0b361d0b8d
commit bcc5321cee
7 changed files with 15 additions and 4 deletions

View file

@ -301,6 +301,15 @@ export class TelegramClient extends BaseTelegramClient {
* Last name of the user (used only for sign-up, defaults to empty)
*/
lastName?: MaybeDynamic<string>
/**
* By using this method to sign up an account, you are agreeing to Telegram
* ToS. This is required and your account will be banned otherwise.
* See https://telegram.org/tos and https://core.telegram.org/api/terms.
*
* If true, TOS will not be displayed and `tosCallback` will not be called.
*/
acceptTos?: boolean
}): Promise<User> {
return startTest.apply(this, arguments)
}

View file

@ -41,7 +41,7 @@ export async function checkPassword(
userId: res.user.id,
isBot: false,
})
await this.storage.save?.()
await this._saveStorage()
return new User(this, res.user)
}

View file

@ -18,7 +18,7 @@ export async function logOut(
if (resetSession) {
this.storage.reset()
await this.storage.save?.()
await this._saveStorage()
}
return true

View file

@ -34,6 +34,7 @@ export async function recoverPassword(
userId: res.user.id,
isBot: false,
})
await this._saveStorage()
return new User(this, res.user)
}

View file

@ -37,7 +37,7 @@ export async function signInBot(
userId: res.user.id,
isBot: true,
})
await this.storage.save?.()
await this._saveStorage()
return new User(this, res.user)
}

View file

@ -45,7 +45,7 @@ export async function signIn(
userId: res.user.id,
isBot: false,
})
await this.storage.save?.()
await this._saveStorage()
return new User(this, res.user)
}

View file

@ -36,6 +36,7 @@ export async function signUp(
userId: res.user.id,
isBot: false,
})
await this._saveStorage()
return new User(this, res.user)
}