From 8c62b56acca4fc4ab45d045a2443edd657b82f52 Mon Sep 17 00:00:00 2001 From: teidesu <86301490+teidesu@users.noreply.github.com> Date: Sun, 18 Jul 2021 22:08:50 +0300 Subject: [PATCH] fix(node): cli input for start() method, not run() --- packages/node/index.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/node/index.ts b/packages/node/index.ts index 6b42af05..e63d3bf8 100644 --- a/packages/node/index.ts +++ b/packages/node/index.ts @@ -89,10 +89,7 @@ export class NodeTelegramClient extends TelegramClient { return new Promise((res) => this._rl!.question(text, res)) } - run( - params: Parameters[0], - then?: (user: User) => void | Promise - ): void { + start(params: Parameters[0] = {}): Promise { 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 }) }