eilvelia / tdl

Node.js bindings to TDLib 🥒
MIT License
394 stars 52 forks source link

Unknown class "uploadFile" #135

Closed omarmyousef closed 1 year ago

omarmyousef commented 1 year ago

whenever i try to invoke the class "uploadFile" this error shows up: { _: 'error', code: 400, message: 'Failed to parse JSON object as TDLib request: Unknown class "uploadFile"' }

Class reference in the tdlib docs: https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1upload_file.html

i've tried to change tdlib version to v1.8.12 using the prebuilt versions here: https://github.com/ForNeVeR/tdlib.native/releases but that didn't fix the issue

my invoke code: upload = await this.client.invoke({ _: 'uploadFile', file: { _: 'inputFileLocal', path: item.params.file } });

Thanks in advance and i appreciate your work guys

eilvelia commented 1 year ago

The docs in https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1upload_file.html are for old TDLib v1.8.0, I think.

uploadFile was renamed to preliminaryUploadFile in later versions: https://github.com/tdlib/td/blob/17e120d7eced6ebcd23041124236c03ffd1db0d6/td/generate/scheme/td_api.tl#L7013

Also, one usually invokes sendMessage directly without uploadFile/preliminaryUploadFile

omarmyousef commented 1 year ago

thanks for explaining i wonder if there's an updated docs for tdlib

eilvelia commented 1 year ago

Usually one just browses the tl file

omarmyousef commented 1 year ago

Thanks <3