Use get_info() to resolve a peer (user, bot, group, or channel) by username or ID. The method returns typed peer constructors (InputPeer, Peer, and so on) that other MTProto methods expect.
User chat info
use danog\MadelineProto\API;
$api = new API('session.file');
$me = $api->get_info('@AlexxxxMz');
Response format:
Array
(
[User] => Array
(
[_] => user
[self] =>
[contact] =>
[mutual_contact] =>
[deleted] =>
[bot] =>
[bot_chat_history] =>
[bot_nochats] =>
[verified] =>
[restricted] =>
[min] =>
[bot_inline_geo] =>
[id] => 368231405
[access_hash] => 3918292757329119123
[first_name] => -=AlexXx=-
[username] => AlexxxxMz
[photo] => Array
(
[_] => userProfilePhoto
[photo_id] => 1581541842291369928
[photo_small] => Array
(
[_] => fileLocation
[dc_id] => 2
[volume_id] => 245015997
[local_id] => 300545
[secret] => -8469737850849287160
)
[photo_big] => Array
(
[_] => fileLocation
[dc_id] => 2
[volume_id] => 245015997
[local_id] => 300547
[secret] => 7331087677799601469
)
)
[status] => Array
(
[_] => userStatusOffline
[was_online] => 1530250170
)
)
[InputPeer] => Array
(
[_] => inputPeerUser
[user_id] => 368231405
[access_hash] => 3918292757329119123
)
[InputUser] => Array
(
[_] => inputUser
[user_id] => 368231405
[access_hash] => 3918292757329119123
)
[Peer] => Array
(
[_] => peerUser
[user_id] => 368231405
)
[DialogPeer] => Array
(
[_] => dialogPeer
[peer] => Array
(
[_] => peerUser
[user_id] => 368231405
)
)
[NotifyPeer] => Array
(
[_] => notifyPeer
[peer] => Array
(
[_] => peerUser
[user_id] => 368231405
)
)
[InputDialogPeer] => Array
(
[_] => inputDialogPeer
[peer] => Array
(
[_] => inputPeerUser
[user_id] => 368231405
[access_hash] => 3918292757329119123
)
)
[InputNotifyPeer] => Array
(
[_] => inputNotifyPeer
[peer] => Array
(
[_] => inputPeerUser
[user_id] => 368231405
[access_hash] => 3918292757329119123
)
)
[user_id] => 368231405
[bot_api_id] => 368231405
[type] => user
)
Bot chat info
use danog\MadelineProto\API;
$api = new API('session.file');
$me = $api->get_info('@btc_tickets_bot');
Response format:
Array
(
[User] => Array
(
[_] => user
[self] =>
[contact] =>
[mutual_contact] =>
[deleted] =>
[bot] => 1
[bot_chat_history] =>
[bot_nochats] =>
[verified] =>
[restricted] =>
[min] =>
[bot_inline_geo] =>
[id] => 560452670
[access_hash] => 8917137522640069112
[first_name] => Биткоины бесплатно!
[username] => btc_tickets_bot
[photo] => Array
(
[_] => userProfilePhoto
[photo_id] => 2407125889062119340
[photo_small] => Array
(
[_] => fileLocation
[dc_id] => 2
[volume_id] => 235138056
[local_id] => 340718
[secret] => -7105503770931191696
)
[photo_big] => Array
(
[_] => fileLocation
[dc_id] => 2
[volume_id] => 235138056
[local_id] => 340720
[secret] => 8414702342356727704
)
)
[bot_info_version] => 5
)
[InputPeer] => Array
(
[_] => inputPeerUser
[user_id] => 560452670
[access_hash] => 8917137522640069112
)
[InputUser] => Array
(
[_] => inputUser
[user_id] => 560452670
[access_hash] => 8917137522640069112
)
[Peer] => Array
(
[_] => peerUser
[user_id] => 560452670
)
[DialogPeer] => Array
(
[_] => dialogPeer
[peer] => Array
(
[_] => peerUser
[user_id] => 560452670
)
)
[NotifyPeer] => Array
(
[_] => notifyPeer
[peer] => Array
(
[_] => peerUser
[user_id] => 560452670
)
)
[InputDialogPeer] => Array
(
[_] => inputDialogPeer
[peer] => Array
(
[_] => inputPeerUser
[user_id] => 560452670
[access_hash] => 8917137522640069112
)
)
[InputNotifyPeer] => Array
(
[_] => inputNotifyPeer
[peer] => Array
(
[_] => inputPeerUser
[user_id] => 560452670
[access_hash] => 8917137522640069112
)
)
[user_id] => 560452670
[bot_api_id] => 560452670
[type] => bot
)
Group / channel chat info
use danog\MadelineProto\API;
$api = new API('session.file');
$me = $api->get_info('@CryptoPumpsChat');
Response format:
Array
(
[Chat] => Array
(
[_] => channel
[creator] => 1
[left] =>
[editor] =>
[broadcast] =>
[verified] =>
[megagroup] => 1
[restricted] =>
[democracy] => 1
[signatures] =>
[min] =>
[id] => 1366131815
[access_hash] => -5066093694859528565
[title] => CryptoPumps Chat
[username] => CryptoPumpsChat
[photo] => Array
(
[_] => chatPhoto
[photo_small] => Array
(
[_] => fileLocation
[dc_id] => 2
[volume_id] => 238227483
[local_id] => 338514
[secret] => 1427158542046898257
)
[photo_big] => Array
(
[_] => fileLocation
[dc_id] => 2
[volume_id] => 238227483
[local_id] => 338516
[secret] => -2326088386895529042
)
)
[date] => 1521028399
[version] => 0
)
[InputPeer] => Array
(
[_] => inputPeerChannel
[channel_id] => 1366131815
[access_hash] => -5066093694859528565
)
[Peer] => Array
(
[_] => peerChannel
[channel_id] => 1366131815
)
[DialogPeer] => Array
(
[_] => dialogPeer
[peer] => Array
(
[_] => peerChannel
[channel_id] => 1366131815
)
)
[NotifyPeer] => Array
(
[_] => notifyPeer
[peer] => Array
(
[_] => peerChannel
[channel_id] => 1366131815
)
)
[InputDialogPeer] => Array
(
[_] => inputDialogPeer
[peer] => Array
(
[_] => inputPeerChannel
[channel_id] => 1366131815
[access_hash] => -5066093694859528565
)
)
[InputNotifyPeer] => Array
(
[_] => inputNotifyPeer
[peer] => Array
(
[_] => inputPeerChannel
[channel_id] => 1366131815
[access_hash] => -5066093694859528565
)
)
[InputChannel] => Array
(
[_] => inputChannel
[channel_id] => 1366131815
[access_hash] => -5066093694859528565
)
[channel_id] => 1366131815
[bot_api_id] => -1001366131815
[type] => supergroup
)
Andrew Dorokhov