Hierarchy (View Summary)

Constructors

Properties

appConfig: AppConfigManager = ...
log: Logger
onConnectionState: Emitter<ConnectionState> = ...
onError: Emitter<Error> = ...
onRawUpdate: Emitter<RawUpdateInfo> = ...
onServerUpdate: Emitter<TypeUpdates> = ...
platform: ICorePlatform
timers: TimersManager
updates?: UpdatesManager

Accessors

  • get isConnected(): boolean
  • Returns boolean

  • get stopSignal(): AbortSignal
  • Returns AbortSignal

Methods

  • Make an RPC call

    This method is still quite low-level and you shouldn't use this when using high-level API provided by @mtcute/client.

    Type Parameters

    • T extends RpcMethod

    Parameters

    Returns Promise<RpcCallReturn[T["_"]]>

  • Parameters

    • dcId: number

    Returns Promise<void>

  • Returns Promise<void>

  • Initialize the connection to the primary DC.

    You shouldn't usually call this method directly as it is called implicitly the first time you call call.

    Returns Promise<void>

  • Export current session to a single LONG string, containing all the needed information.

    Warning! Anyone with this string will be able to authorize as you and do anything. Treat this as your password, and never give it away!

    In case you have accidentally leaked this string, make sure to revoke this session in account settings: "Privacy & Security" > "Active sessions" > find the one containing mtcute > Revoke, or, in case this is a bot, revoke bot token with @BotFather

    Returns Promise<string>

  • Returns Promise<{ hash: string; id: number }>

  • Import the session from the given session string.

    Note that the session will only be imported in case the storage is missing authorization (i.e. does not contain auth key for the primary DC), otherwise it will be ignored (unless force).

    Parameters

    • session: string | InputStringSessionData

      Session string to import

    • force: boolean = false

      Whether to overwrite existing session

    Returns Promise<void>

  • Parameters

    • channelId: number

    Returns Promise<boolean>

  • Parameters

    • channelId: number
    • Optionalpts: number

    Returns Promise<boolean>

  • ADVANCED

    Do all the preparations, but don't connect just yet. Useful when you want to do some preparations before connecting, like setting up session.

    Call connect to actually connect.

    Returns Promise<void>

  • Parameters

    • dcId: number

    Returns Promise<void>