telegram.link icon indicating copy to clipboard operation
telegram.link copied to clipboard

importContacts and getFullUser methods

Open denistex opened this issue 9 years ago • 5 comments

Hi guys and thanks for the great project!

I've added a couple of API methods, review them please. Comments are welcome.

Thanks, Denis.

denistex avatar Sep 23 '16 12:09 denistex

Coverage Status

Coverage increased (+0.05%) to 90.217% when pulling f56704cee3711122e3e0b846effc43440d8a8741 on denis-it:master into 37c4a98f17d2311ee4335fdd42df497ff30a1153 on enricostara:master.

coveralls avatar Sep 23 '16 12:09 coveralls

using importContacts with non-latin first or last name causes 404 error :( how can i fix that?

FragsterAt avatar Feb 17 '17 09:02 FragsterAt

Hi @FragsterAt,

It looks like request with non-latin characters constructed incorrectly, so the server returns 404. I think good points to start research are following:

Hope this helps.

denistex avatar Feb 18 '17 12:02 denistex

@denis-it At first glance, this solves the problem:

// Write the `string` value given as argument
TypeObject.prototype.writeString = function (str) {
    //return this.writeBytes(str);
    return this.writeBytes(Buffer.from(str));
};

you can use it same way in https://github.com/goodmind/telegram-mtproto and https://github.com/zerobias/telegram-mtproto if they're buggy. I can not check, because I can't call importContacts with any arguments: https://github.com/zerobias/telegram-mtproto/issues/6

cc @zerobias

FragsterAt avatar Feb 18 '17 17:02 FragsterAt

I've checked it, working fine with Buffer.from(str). Good work, @FragsterAt! :+1:

denistex avatar Feb 18 '17 20:02 denistex