I'm not able to use the SendMessageAsync method to forward a message.
Is there any way to do it?
I'm not able to use the SendMessageAsync method to forward a message.
Is there any way to do it?
You cannot use the SendMessageAsync
helper method for that. You need to use the API method Messages_ForwardMessages
Here is an example code that forwards the pinned message from from_chat to to_chat:
using var client = new WTelegram.Client(Environment.GetEnvironmentVariable);
await client.LoginUserIfNeeded();
var chats = await client.Messages_GetAllChats();
var from_chat = chats.chats[1234567890]; // source chat
var to_chat = chats.chats[1234567891]; // destination chat
var fullChat = await client.GetFullChat(from_chat);
var msgId = fullChat.full_chat.PinnedMsg; // id of msg in source chat
await client.Messages_ForwardMessages(from_chat, new[] { msgId }, new[] { WTelegram.Helpers.RandomLong() }, to_chat);