UNPKG

@tgsnake/core

Version:

Pure Telegram MTProto library for nodejs

64 lines (63 loc) 2.63 kB
import { AbstractSession } from './Abstract.js'; import { Raw } from '../raw/index.js'; import { Buffer } from '../platform.node.js'; import type { SecretChat } from './SecretChat.js'; export declare function getInputPeer(id: bigint, accessHash: bigint, type: string): Raw.InputPeerUser | Raw.InputPeerChat | Raw.InputPeerChannel; export declare class BaseSession extends AbstractSession { protected _ip: string; protected _dcId: number; protected _port: number; protected _peers: Map<bigint, [ id: bigint, accessHash: bigint, type: string, username?: Array<string>, phoneNumber?: string ]>; protected _secretChats: Map<number, SecretChat>; protected _authKey: Buffer; protected _testMode: boolean; protected _apiId: number; protected _userId: bigint; protected _isBot: boolean; constructor(); setAddress(dcId: number, ip: string, port: number, testMode: boolean): void; setAuthKey(authKey: Buffer, dcId: number): void; setApiId(apiId: number): void; setIsBot(isbot: boolean): void; setUserId(userId: bigint): void; get authKey(): Buffer<ArrayBufferLike>; get isBot(): boolean; get testMode(): boolean; get userId(): bigint; get apiId(): number; get dcId(): number; get port(): number; get ip(): string; get peers(): Map<bigint, [id: bigint, accessHash: bigint, type: string, username?: string[] | undefined, phoneNumber?: string | undefined]>; get secretChats(): Map<number, SecretChat>; load(): Promise<void>; delete(): Promise<void>; save(): Promise<void>; updatePts(_pts: number, _date: number): Promise<void>; getPts(): Promise<[pts: number, date: number]>; move(session: AbstractSession): Promise<void>; updatePeers(peers: Array<[ id: bigint, accessHash: bigint, type: string, username?: Array<string>, phoneNumber?: string ]>): Promise<void>; updateSecretChats(chats: Array<SecretChat>): Promise<void>; getSecretChatById(id: number): Promise<SecretChat | undefined>; getPeerById(id: bigint): Promise<Raw.InputPeerUser | Raw.InputPeerChat | Raw.InputPeerChannel | undefined>; getPeerByUsername(username: string): Promise<Raw.InputPeerUser | Raw.InputPeerChat | Raw.InputPeerChannel | undefined>; getPeerByPhoneNumber(phoneNumber: string): Promise<Raw.InputPeerUser | Raw.InputPeerChat | Raw.InputPeerChannel | undefined>; removeSecretChatById(id: number): Promise<boolean>; exportString(): string; toJSON(): { [key: string]: any; }; toString(): string; }