v0.102.0
Yes
I would like to ask why, when I use MessagesForwardMessages to directly forward messages, only the messages I send can be successfully forwarded. Messages sent by others always show the error 'rpcDoRequest: rpc error code 400: CHANNEL_INVALID'. I am certain that the channel can normally forward messages. Is there something wrong with the way I am using it? I've been struggling with this for quite a while.
rand.NewSource(time.Now().UnixNano())
randomID := rand.Int63() // 生成一个随机的长整数
request := &tg.MessagesForwardMessagesRequest{
FromPeer: &tg.InputPeerChannel{ChannelID: chatID, AccessHash: chatAccessHash},
ToPeer: &tg.InputPeerChannel{ChannelID: targetChannelID, AccessHash: targetChannelAccessHash},
ID: []int{msg.GetID()},
RandomID: []int64{randomID}, // 设置 random_id 以防止重复转发
//DropAuthor: true, // 不转发作者信息
}
//fmt.Printf("\nrequest: %+v\n\n", request)
// 轉發消息
_, err := api.MessagesForwardMessages(ctx, request)
if err != nil {
fmt.Printf("轉發失敗: %s\n", err)
return err
} else {
fmt.Println("轉發成功")
}
Can be forwarded successfully
'rpcDoRequest: rpc error code 400: CHANNEL_INVALID'
go v1.21
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too