Git Product home page Git Product logo

Comments (4)

delivrance avatar delivrance commented on May 7, 2024 1

All the latest functions and types are coming straight from the official Telegram clients schema, but they aren't documented at all. Fortunately, the names are descriptive enough to get an idea of what they do.

Anyway, it turns out that this approach is actually used by the official Android app: it saves raw messages plus the layer number and loads them again when needed using the correct schema.

I'll flag this as enhancement. Maybe we could add support for old layers someday, but for now this is a low priority. Thanks for the suggestion ^^

from pyrogram.

delivrance avatar delivrance commented on May 7, 2024

Weird use case, but yeah is surely possible. Any Pyrogram Object (both types and functions) can be serialized using the .write() method. You get a bytes string which can be loaded again using Object.read(b) (b must be a BytesIO object), from pyrogram.api.core.Object.

The only downside would be versioning. New layer updates could modify the types/functions schema and you won't be able to load old objects with the updated library. This can be handled by saving the layer number as well in your DB, but Pyrogram currently lacks support for older layers.

from pyrogram.

4l1fe avatar 4l1fe commented on May 7, 2024

I understand about versioning that makes sense. Thx much for your advice.

Why do i use this approach? because i don't know clearly how to use lot of functions, types(i/ve been learning it) but i need to save accounts data now. Don't lost it. And in the future i'll extract info what i'm intrested in from objects

from pyrogram.

delivrance avatar delivrance commented on May 7, 2024

This is unlikely to happen. Closing for now.

from pyrogram.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.