Comments (7)
@vtolstov you should use upload.getFile
method. Of course at first you should get volume_id
, local_id
and secret
.
Example:
res, err := t.mtproto.InvokeSync(mtproto.TL_upload_getFile{
Location: mtproto.TL_inputFileLocation{
Volume_id: volumeId,
Local_id: localId,
Secret: secret,
},
Offset: offset,
Limit: 65536,
})
if err != nil {
return nil, err
}
switch (*res).(type) {
case mtproto.TL_upload_file:
return (*res).(mtproto.TL_upload_file).Bytes, nil
}
return nil, errors.New("UNKNOWN TYPE RETURNED")
from mtproto.
Wow THANKS!
from mtproto.
@vtolstov there is some problem right now. You could download files only from Data Center that you use. For Russia and CIS Telegram prefers second DC, for example. If you will try to download file from another DC you will get error FILE_MIGRATE_dcNumber
.
But contributitions are welcome :)
from mtproto.
Hmm. i have mtproto.TL_fileLocation and not mtproto.TL_inputFileLocation
from mtproto.
and i'm from russia =)
from mtproto.
@vtolstov mtproto.TL_fileLocation
you have in answer from Telegram with file. TL_inputFileLocation
should used to request it.
from mtproto.
Example to get fileLocation variables:
if user, ok := res.(mtproto.TL_user); ok {
if photo, ok := user.Photo.(mtproto.TL_userProfilePhoto); ok {
if photoSmall, ok := photo.Photo_small.(mtproto.TL_fileLocation); ok {
return Photo{
photoSmall.Dc_id
photoSmall.Volume_id,
photoSmall.Local_id,
photoSmall.Secret,
}
}
}
}
And then use it upload.getFile
method.
from mtproto.
Related Issues (20)
- output order
- slice bounds out of range
- Handle File_Migrate_x error
- Configuration is anti-pattern.
- Split MTProto into two objects: network and mtproto HOT 1
- Unknown constructor: 1cb5c415
- Write new example tool or fix current HOT 1
- server error code -404 HOT 1
- MTProto 2.0
- How to send media? HOT 1
- Fatal Error on AuthSendCode: use of closed network connection HOT 2
- How do I search for channels and subscribe to them? HOT 1
- connection Error HOT 2
- Handle multiple sessions
- How to add scheduled_date HOT 2
- Library doesn't handle correctly connection closed by server HOT 1
- Invoke Method HOT 1
- Encode error on TL_auth_checkPassword
- auth_key_unregistered error HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mtproto.