Name | Type | Description |
---|---|---|
auth |
Auth |
Authorization helper |
client |
Client |
API client |
updates |
Updates |
Getting updates |
bind |
function | Shortcut for Client.bind |
catch |
function | Shortcut for Client.catch |
on |
function | Shortcut for Client.on |
use |
function | Shortcut for Client.use |
Name | Type | Description |
---|---|---|
client |
Client |
API client |
maxAttempts |
number |
Number of wrong authorizations before throw an exception. Default: 3. |
catch |
(handler: (error: Error ) => void ): Auth |
Set authorization error handler |
checkCode |
checkCode (code: string ): Promise<AuthAuthorizationUnion > |
Send secret code to Telegram |
login |
(): Promise<AuthAuthorizationUnion > |
Start authorization |
logout |
logout (): Promise<boolean > |
Destroy authorization session |
on |
(predicate: string, ...fns: Array<(ctx, next) => any>): Auth |
Set authorization middleware for the mounted predicate |
use |
(...fns: Array<(ctx, next) => any>): Auth |
Set authorization middleware |
Name | Type | Description |
---|---|---|
me |
{id: number} | User identity |
account |
object | See Account |
auth |
object | See Auth |
bots |
object | See Bots |
channels |
object | See Channels |
config |
object | Airgram config |
contacts |
object | See Contacts |
help |
object | See Help |
langpack |
object | See Langpack |
messages |
object | See Messages |
payments |
object | See Payments |
phone |
object | See Phone |
photos |
object | See Photos |
stickers |
object | See Stickers |
updates |
object | See Updates |
upload |
object | See Upload |
users |
object | See Users |
catch |
(handler: (error: Error ) => void |
Sets a custom error handler |
destroy |
(): Promise<void > |
Destroys a Telegram client and clears memory. |
Name | Type | Description |
---|---|---|
getDifference |
(): Promise<UpdatesDifferenceUnion > |
Get updates difference |
startPolling |
(): Promise<any > |
Start getting updates |
stop |
(): Promise<void > |
Stop getting updates |
Name | Type | Description |
---|---|---|
isFileTransfer |
boolean |
Set true when download or upload a file |
timeout |
number |
Max time to wait for the response |