fix(node): cli input for start() method, not run()
This commit is contained in:
parent
199e0a2a7d
commit
8c62b56acc
1 changed files with 3 additions and 6 deletions
|
@ -89,10 +89,7 @@ export class NodeTelegramClient extends TelegramClient {
|
|||
return new Promise((res) => this._rl!.question(text, res))
|
||||
}
|
||||
|
||||
run(
|
||||
params: Parameters<TelegramClient['start']>[0],
|
||||
then?: (user: User) => void | Promise<void>
|
||||
): void {
|
||||
start(params: Parameters<TelegramClient['start']>[0] = {}): Promise<User> {
|
||||
if (!params.botToken) {
|
||||
if (!params.phone) params.phone = () => this.input('Phone > ')
|
||||
if (!params.code) params.code = () => this.input('Code > ')
|
||||
|
@ -100,13 +97,13 @@ export class NodeTelegramClient extends TelegramClient {
|
|||
params.password = () => this.input('2FA password > ')
|
||||
}
|
||||
|
||||
super.run(params, (user) => {
|
||||
return super.start(params).then((user) => {
|
||||
if (this._rl) {
|
||||
this._rl.close()
|
||||
delete this._rl
|
||||
}
|
||||
|
||||
return then?.(user)
|
||||
return user
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue