gramjs: Error: Cannot cast to any kind of peer
Hello! After 2.0 update I have a problem with getting group id. My code dont have any changes before 2.0 update of this package.
When im trying to get group id, i have a error: “Cannot cast https://t.me/linkToAnyGroup to any kind of peer.”
Im using js, not ts.
Here is my code:
async function getGroupId() {
const result = await client.invoke(
new Api.channels.GetFullChannel({
channel: tgLinkFromInput,
})
);
let jsonResult = JSON.stringify(result, null, 2);
let parsedResult = JSON.parse(jsonResult);
return parsedResult['fullChat']['id'];
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (7 by maintainers)
With the new updates telegram has made ids 64bit (bigInts in JS) and stopped older layers from working. GramJS now converts strings to IDs because they can’t be normal numbers anymore and that has broken link and phone resolving.
This will be fixed soon. For phones you will be required to add a “+” and for links it’ll work as it used to.