I’m connecting to Telegram API with this C# library: TLSharp
The resources for this library is not enough, I’m trying to Forward a message to channel .
I’m not quiet sure how to get channel post peer
id (for forward function input parameters)
var store = new FileSessionStore();
var client = new TelegramClient(Properties.Settings.Default.apiID, Properties.Settings.Default.apiHash, store, "session");
await client.ConnectAsync();
var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
var chat = dialogs.chats.lists
.OfType<TLChannel>()
.SingleOrDefault(a=>a.title=="test");
await client.SendRequestAsync<TLAbsUpdates>(
new TLRequestForwardMessage()
{
id = 2,
peer = new TLInputPeerChannel() { channel_id = chat.id, access_hash = chat.access_hash.Value },
random_id = Helpers.GenerateRandomLong()
});
I get this error message :
{“PEER_ID_INVALID”}
Please help me, what is that peer id and how can i access and use that for forwarding a message using TLSharp. Thanks.
3
Answers
This code can be used for forward
**
**---------------------------------
You can do that with this nice trick which is hilarious: this code is below:
And this is my code to Forward a message:
I can’t use this method, and have to use this one