gramjs icon indicating copy to clipboard operation
gramjs copied to clipboard

How To Listen For Phone Events Gram-JS

Open ch3rn1k opened this issue 1 year ago • 0 comments

Hello! Maybe I can be wrong, but have I missing event for calls handling event?

Let me explain - I have a code, that calls a user and then I wan'to to play an audio file, For now all I have is, hope you can get any tips, ty

import "dotenv/config";

import { Api } from "telegram";
import { client } from "./client";
import { getGAHash } from "./utils";

(async () => {
  await client.connect();

  const doCall: Api.phone.PhoneCall = await client.invoke(
    new Api.phone.RequestCall({
      userId: "SomeTestUser",
      randomId: Math.floor(Math.random() * 0x7ffffffa),
      gAHash: await getGAHash(),
      protocol: new Api.PhoneCallProtocol({
        minLayer: 93,
        maxLayer: 93,
        libraryVersions: [],
        udpP2p: true,
        udpReflector: true,
      }),
    })
  );
  console.log(doCall);
})();

UPD: I have found some docs, but I don't know how that helps me https://gram.js.org/beta/classes/Api.PhoneCallAccepted.html

ch3rn1k avatar Nov 16 '23 17:11 ch3rn1k