How i can send message to new user via WTelegramClient?
var peer = new InputPeerUser(user.id,user.access_hash);
await _client.SendMessageAsync(peer, "hello");
it returns peer_id_invalid
. Why?
How i can send message to new user via WTelegramClient?
var peer = new InputPeerUser(user.id,user.access_hash);
await _client.SendMessageAsync(peer, "hello");
it returns peer_id_invalid
. Why?
It depends where the user id/access_hash are coming. A user access_hash is valid only on the logged-in account it was retrieved from.
Also, with WTelegramClient, you do not need to build
InputPeerUser
manually, just pass aUser
object where anInputPeerUser
is expected, and that structure will be created for you implicitly.So the solution is to fetch the
User
structure you want, using any API calls or Updates monitoring, and use thatUser
on yourSendMessageAsync
call.For more information, read this FAQ