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.
You can do that with this nice trick which is hilarious: this code is below:
new TLInputPeerChannel { channel_id = chat.id, access_hash = cha.access_hash.Value }, offset,
maxId, limit);
This code can be used for forward
**
await client.SendRequestAsync<TLAbsUpdates>( new TLRequestForwardMessage() { id = item2.Id, peer = new TLInputPeerChat() { chat_id = item.id }, random_id = Helpers.GenerateRandomLong(), });
---------------------------------------
**---------------------------------
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With