Cannot receive message from super group, and ChatID for normal group not correct
What version of gotd are you using?
github.com/gotd/td v0.115.0
Can this issue be reproduced with the latest version?
Yes
What did you do?
Just run echo bot example
What did you expect to see?
should echo in super group, it echo as expected in normal Telegram group I test the same bot(same appId, appHash, botToken) with pyrogram, pyrogram can receive message from the same super group
What did you see instead?
nothing
What Go version and environment are you using?
`` go version go1.23.3 windows/amd64
And there is another bug, the ChatID from group or super group should be negative
it's weird, the telegram super group message is actually NewChannelMessage ?
This is the specifics of Telegram's work, not the library's
Channel - ids starts with -100 Chat - other ids
Channel - ids starts with -100 Chat - other ids
ok, finally I figure out that pyrogram do a convertion for channel/chat/user id just for convenience, in the telegram protocol, all ids are positive
https://github.com/pyrogram/pyrogram/blob/master/pyrogram/utils.py
def get_peer_id(peer: raw.base.Peer) -> int:
"""Get the non-raw peer id from a Peer object"""
if isinstance(peer, raw.types.PeerUser):
return peer.user_id
if isinstance(peer, raw.types.PeerChat):
return -peer.chat_id
if isinstance(peer, raw.types.PeerChannel):
return MAX_CHANNEL_ID - peer.channel_id
raise ValueError(f"Peer type invalid: {peer}")