xtrime-ru / TelegramApiServer

Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
https://tg.i-c-a.su
MIT License
576 stars 130 forks source link

downloadToFile #65

Closed Maverick1983 closed 3 years ago

Maverick1983 commented 3 years ago

I use this downloadToFile?data["media"]["_"]=inputMediaUploadedDocument&data["media"]["file"]["_"]=inputFile&data["media"]["file"]["id"]=5742225891161704365&data["media"]["file"]["name"]=test.txt

I receved this response

{ "success": false, "errors": [ { "exception": "ArgumentCountError", "message": "Too few arguments to function danog\\MadelineProto\\InternalDoc::downloadToFile(), 1 passed in /app-host-link/src/Controllers/AbstractApiController.php on line 161 and at least 2 expected", "file": "/app-host-link/vendor/danog/madelineproto/src/danog/MadelineProto/InternalDoc.php", "line": 4878, "code": 0, "backtrace": [ { "file": "/app-host-link/src/Controllers/AbstractApiController.php", "line": 161, "function": "downloadToFile", "class": "danog\\MadelineProto\\InternalDoc", "type": "->", "args": [ { "\"media\"": { "\"_\"": "inputMediaUploadedDocument", "\"file\"": { "\"_\"": "inputFile", "\"id\"": "5742225891161704365", "\"name\"": "test.txt" } } } ] }

xtrime-ru commented 3 years ago

downloadToFile requires 2 argiments: MessageMedia array and path to file. You provided only first argument with array.

xtrime-ru commented 3 years ago

Should be something like this: downloadToFile?data["media"]["_"]=inputMediaUploadedDocument&data["media"]["file"]["_"]=inputFile&data["media"]["file"]["id"]=5742225891161704365&data["media"]["file"]["name"]=test.txt&data["file"]=path/to/output/text.txt