const session = new StringSession("");
const client = new TelegramClient(session, user.apiId, user.apiHash, {});
client.connect();
const result = await client.invoke(
new Api.auth.SendCode({
phoneNumber: user.phone,
apiId: parseInt(user.apiId),
apiHash: user.apiHash,
settings: new Api.CodeSettings({
allowFlashcall: true,
currentNumber: true,
allowAppHash: true,
allowMissedCall: true,
}),
})
);
I'm building Telegram bot which gives users their session string. I cannot use client.start() because data should be received partially, message by message, so i chose manually collecting data from user, then sending security code and then prompt user to enter it, then getting session by logging into account. In the code above i tried to send code to user, but it says Cannot send requests while disconnected. You need to call .connect()
I'm building Telegram bot which gives users their session string. I cannot use client.start() because data should be received partially, message by message, so i chose manually collecting data from user, then sending security code and then prompt user to enter it, then getting session by logging into account. In the code above i tried to send code to user, but it says Cannot send requests while disconnected. You need to call .connect()