resolve_peer()#

Client.resolve_peer()#

Get the InputPeer of a known peer id. Useful whenever an InputPeer type is required.

Note

This is a utility method intended to be used only when working with raw functions (i.e: a Telegram API method you wish to use which is not available yet in the Client class as an easy-to-use method).

Usable by Users Bots
Parameters:

peer_id (int | str) – The peer id you want to extract the InputPeer from. Can be a direct id (int), a username (str) or a phone number (str).

Returns:

InputPeer – On success, the resolved peer id is returned in form of an InputPeer object.

Raises:

KeyError – In case the peer doesn’t exist in the internal database.