td icon indicating copy to clipboard operation
td copied to clipboard

getUserGifts/getUserGift returns None

Open CryptoAllcash opened this issue 11 months ago • 7 comments

when trying to call almost any method related to gifts I always receive None. also haven't seen that these methods were implemented even though they are mentioned in the docs

CryptoAllcash avatar Feb 17 '25 13:02 CryptoAllcash

This isn't related to the Bot API server, You receive None from your Bot API library/framework.

levlam avatar Feb 17 '25 13:02 levlam

I am using them directly through the tdlib json interface.

I used this as an example https://github.com/tdlib/td/blob/master/example/python/tdjson_example.py

and tried using this method: https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1get_user_gifts.html

when I try to see the response via td_receive I am seeing None

if you can show how to call it correctly, I'd really appreciate that

I was using td_send({'@type': 'getUserGifts', 'user_id': 762137, 'offset': "", 'limit': 10 })

CryptoAllcash avatar Feb 17 '25 14:02 CryptoAllcash

See https://core.telegram.org/tdlib/docs/td__json__client_8h.html for the description of the correct usage of the JSON interface.

levlam avatar Feb 18 '25 06:02 levlam

I am already using this. I tried calling a few other methods like getUser or getAvailableGifts and everything works as expected.

When I try to call getUserGifts I receive this: b'{'@type': 'error', 'code': 400, 'message': 'Failed to parse JSON object as TDLib request: Unknown class "getUserGifts"', '@client_id': 1}'

Please help, I checked the docs a couple of times and I don't see any difference between those methods besides the parameters.

CryptoAllcash avatar Feb 18 '25 23:02 CryptoAllcash

The error means that your TDLib version doesn't support the request. You use documentation from a different version.

levlam avatar Feb 19 '25 21:02 levlam

So I was using these website as mentioned in getting started to build the tdlib. https://tdlib.github.io/td/build.html

I've made a search through all of the files and in this repository this function getUserGifts doesn't exist. Other functions do exist like getAvailableGifts and that's why they are working. So where can I get a different version of the tdlib?

CryptoAllcash avatar Feb 21 '25 01:02 CryptoAllcash

The build instructions build the latest TDLib version. You can find documentation for the latest version at https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl.

levlam avatar Feb 21 '25 07:02 levlam