gramjs icon indicating copy to clipboard operation
gramjs copied to clipboard

How to get user info and join to channel , Error PeerUser

Open apikidy opened this issue 2 years ago • 1 comments

i'am request

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.channels.GetParticipants({
      channel: "pocoitaliaufficiale",
      filter: new Api.ChannelParticipantsRecent({}),
      offset: 0,
      limit: 5,
      hash: 0,
    })
  );
  console.log(result); // prints the result
  res.send(result);
})();

and i will json result

"users": [
        {
            "flags": 33570859,
            "self": false,
            "contact": false,
            "mutualContact": false,
            "deleted": false,
            "bot": true,
            "botChatHistory": false,
            "botNochats": false,
            "verified": false,
            "restricted": false,
            "min": false,
            "botInlineGeo": false,
            "support": false,
            "scam": false,
            "applyMinPhoto": true,
            "fake": false,
            "botAttachMenu": false,
            "id": "689374041",
            "accessHash": "4621180786052717638",
            "firstName": "Community Help",
            "lastName": null,
            "username": "Android_Applicant_bot",
            "phone": null, 
            "status": null,
            "botInfoVersion": 1,
            "restrictionReason": null,
            "botInlinePlaceholder": null,
            "langCode": null,
            "className": "User"
        },

and i will request info by userid 689374041

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.users.GetFullUser({
      id: "689374041",
    })
  );
  console.log(result); // prints the result
})();

but error Error: Could not find the input entity for {"userId":"689374041","className":"PeerUser"}.

i want to userid 689374041 join to channel

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()
  const result = await client.invoke(
    new Api.channels.InviteToChannel({
      channel: "testinvitechannel",
      users: ["689374041"],
    })
  );
  console.log(result); // prints the result
})();

but error Error: Could not find the input entity for {"userId":"689374041","className":"PeerUser"}.

How can? please.. Help. Thanks

apikidy avatar Jun 12 '22 14:06 apikidy

Hey man, same problem. Did you find a solution?

ljs19923 avatar Sep 16 '22 11:09 ljs19923