A
A
Arman Baelov2019-03-19 01:48:33
Python
Arman Baelov, 2019-03-19 01:48:33

How to add a user to telegram contacts?

How to add a user to the contact book in telegram through the telethon library, knowing only his id?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Danil K., 2019-06-07
@Danya_Violet

contact = InputPhoneContact(client_id = 0, phone = "+12345678", first_name="ABC", last_name="abc")
result = client.invoke(ImportContactsRequest([contact], replace=True))

www.stackoverflow.com

A
Abdula Magomedov, 2016-12-01
@Avarskiy

$keys = array_keys($arr["ELEMENTS"]);
sort($keys);
$arr["ELEMENTS"] = array_map(function ($val) {
    return [
        $val => [
            "ID" => $val
        ]
    ];
}, $keys);

S
Snewer, 2016-12-01
@Snewer

Haven't tested it, but have a look at this one:

usort($arr['ELEMENTS'], function($a, $b){ return $a['ID'] > $b['ID'] });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question