-
-
Notifications
You must be signed in to change notification settings - Fork 173
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of gotd are you using?
github.com/gotd/td v0.122.0
Can this issue be reproduced with the latest version?
Yes
What did you do?
telegram.ClientFromEnvironment()
...
dispatcher.OnNewChannelMessage(func(ctx context.Context, e tg.Entities, update *tg.UpdateNewChannelMessage) error {
m, ok := update.Message.(*tg.Message)
if !ok || m.Out {
return nil
}
if m.PeerID == nil {
return nil
}
peer, cast := m.PeerID.(*tg.PeerChannel)
if !cast {
return nil
}
channel := e.Channels[peer.ChannelID]
if _, e := sender.To(channel.AsInputPeer()).Reply(m.ID).Text(ctx, "Test"); e != nil {
fmt.Println(e.Error())
return e
}
return nil
})
What did you expect to see?
I expect such a simple code to work in any chat
What did you see instead?
In some channels it works but in some I get sendMessage RPCError: 400: CHANNEL_INVALID. Looks like InputPeer is only valid if there is a tag or a reply to a message. The user has no restrictions when this error is observed.
What Go version and environment are you using?
go version go1.24.2 windows/amd64Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working