Parameters to be passed to start
Optional
abortAbort signal
Optional
botBot token to use. Ignored if phone
is supplied.
Optional
code?: MaybeDynamic<string>Code sent to the phone (either sms, call, flash call or other).
Ignored if botToken
is supplied, must be present if phone
is supplied.
Optional
codeCustom method that is called when a code is sent. Can be used to show a GUI alert of some kind.
This method is called before start.params.code.
Optional
codeAdditional code settings to pass to the server
Optional
forceWhether to force code delivery through SMS
Optional
futureSaved future auth tokens, if any
Optional
invalidIf passed, this function will be called if provided code or 2FA password was invalid. New code/password will be requested later.
If provided code
/password
is a constant string, providing an
invalid one will interrupt authorization flow.
Optional
password?: MaybeDynamic<string>2FA password. Ignored if botToken
is supplied
Optional
phone?: MaybeDynamic<string>Phone number of the account. If account does not exist, it will be created
Optional
qrWhen passed, QR login flow will be used instead of the regular login flow.
This function will be called whenever the login URL is changed, and the app is expected to display it as a QR code to the user.
Optional
session?: string | StringSessionDataString session exported using TelegramClient.exportSession.
This simply calls TelegramClient.importSession before anything else.
Note that passed session will be ignored in case storage already contains authorization.
Optional
sessionWhether to overwrite existing session.
Optional
then: ((user: User) => void | Promise<void>)Function to be called after start returns
This method provides no real value over start, please use it instead
Simple wrapper that calls start and then provided callback function (if any) without the need to introduce a
main()
function manually.Errors that were encountered while calling start and
then
will be emitted as usual, and can be caught with onError