Error: Cannot cast to any kind of peer
See original GitHub issueHello! 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'];
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (7 by maintainers)
Top Results From Across the Web
TypeError: Cannot cast NoneType to any kind of Peer ... - GitHub
When a user with 64-bit ID sends a message to Bot (updates for userbot work as expected), there is no peer in incoming...
Read more >Telethon can't get chat entity anymore - Stack Overflow
As far as the error you got, get_entity returns coroutine so it must be awaited. >> TypeError: Cannot cast coroutine to any kind...
Read more >TelegramClient — Telethon 1.26.1 documentation
When API calls fail in a way that causes Telethon to retry automatically, should the RPC error of the last attempt be raised...
Read more >intToPtr - Documentation - The Zig Programming Language
undefined can be implicitly cast to any type. Once this happens, it is no longer possible to detect that the value is undefined...
Read more >Users, Chats and Channels — Telethon 1.7.7 documentation
Sometimes, Telegram only needs to indicate the type of the entity along with their ID. For this purpose, Peer versions of the entities...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
@painor
2.0.5
seems to fix the issue, thanks a lot 😃