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 a User
object where an InputPeerUser
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 that User
on your SendMessageAsync
call.
For more information, read this FAQ