Code Monkey home page Code Monkey logo

Comments (25)

stek29 avatar stek29 commented on June 9, 2024 3

@FragsterAt there's no publicly available API documentation.
However, I find tjhorner.com/tl-schema and tjhorner.com/webogram really useful when playing around with API.

Also, schema at Telegram site doesn't have mtSchema in it afaiu.

from telegram-mtproto.

wfjsw avatar wfjsw commented on June 9, 2024 3

You could get latest schema here(layer 62 atm) and my little parser in js here :)

UPDATE: multiple bug fixed
UPDATE1: things are far more than I think. Attempting to fix

from telegram-mtproto.

zerobias avatar zerobias commented on June 9, 2024 2

The custom schema can be set as schema field on ApiManager constructor.
Mtproto schema setted at mtSchema field.
E.g.

const apiSchema = require('./api-57.json')
const mtSchema = require('./mtproto-57.json')

new ApiManager({ schema: apiSchema, mtSchema: mtSchema })

Or, it may be better to make a common field for the scheme?

const schema57 = {
  api: apiSchema,
  mt: mtSchema
}

new ApiManager({ schema: schema57 })

from telegram-mtproto.

stek29 avatar stek29 commented on June 9, 2024 1

@zerobias sorry, I've lost link to this repo, lol.
I've made a gist for now.
I want to add support for other formats (like Android's app TLRPC.java) later, I'll make a repo when I do it.

UPD: added usage example.

from telegram-mtproto.

goodmind avatar goodmind commented on June 9, 2024 1

@terrasoff NEVER believe to official docs

from telegram-mtproto.

FragsterAt avatar FragsterAt commented on June 9, 2024

How to correctly use the scheme from https://core.telegram.org/schema/json ? Shemas from https://github.com/zerobias/telegram-mtproto/tree/mtproto2/schema contain errors (third method that I have tried: getDialogs :))

now I'm using it this way:

const fileSchema = require('./api-tlschema-57');
const telegramShema = require('./telegramShema');
fileSchema.methods = telegramShema.methods;

from telegram-mtproto.

goodmind avatar goodmind commented on June 9, 2024

@FragsterAt scheme from telegram site is outdated

from telegram-mtproto.

FragsterAt avatar FragsterAt commented on June 9, 2024

@goodmind ok, but where can I get the actual API documentation?

from telegram-mtproto.

goodmind avatar goodmind commented on June 9, 2024

@FragsterAt On official site - nowhere :) But you can look in schema... or we can make docs later

from telegram-mtproto.

DenisIzmaylov avatar DenisIzmaylov commented on June 9, 2024

It would be great. Let's keep this issue for tracking change request to the docs.

from telegram-mtproto.

zerobias avatar zerobias commented on June 9, 2024

@stek29 Wow, great! I found only 57 json schema

from telegram-mtproto.

zerobias avatar zerobias commented on June 9, 2024

Looks like we should implement Type Language schema translator

from telegram-mtproto.

stek29 avatar stek29 commented on June 9, 2024

@zerobias I have made a simple script, but it's written in Python 🙃
I could upload it when I get to laptop if needed.
But it's not that hard: the only problem may be parsing hex numbers as int32

from telegram-mtproto.

zerobias avatar zerobias commented on June 9, 2024

@stek29 It would be great) Python isn't a problem

from telegram-mtproto.

zerobias avatar zerobias commented on June 9, 2024

@stek29 thanks!

from telegram-mtproto.

zerobias avatar zerobias commented on June 9, 2024

@wfjsw Is something wrong? Scheme looks well

from telegram-mtproto.

wfjsw avatar wfjsw commented on June 9, 2024

@zerobias Since I have nothing to validate the generated schema file, the only proofreading tool I have is my eyes.
Fixed Bugs:
Revision 2 - fix 'method' being parsed as 'predicate'
Revision 3 - fix param {X:Type} being parsed as {X Type}
Revision 4 - fix compacter that fails to remove all ;
Revision 5 - make vector have no params
Revision 6 - trim the string before split & turn hardcoded scheme.tl to argument-based naming

I believe there is more bugs that I haven't discovered coz I still get Exceptions.
And I don't know how actually do you tell between Schema & mtSchema.

from telegram-mtproto.

zerobias avatar zerobias commented on June 9, 2024

@wfjsw In addition to the main application scheme, there is a scheme for the low, network layer. It is described here.

At the moment I am working on an application to view the schemes and navigate them conveniently. I tried to include this code there, and the scheme was interpreted correctly, I did not notice any issues

from telegram-mtproto.

wfjsw avatar wfjsw commented on June 9, 2024

@zerobias I was hit by exceptions when I am working with old telegram.link code with l62.
There is still some issues, For example I am getting weird chars like /æDÚ<¢ as PQ (both in telegram.link and telegram-mtproto).
No idea why,

Have to work with obsolete code coz I got confusing AUTH_KEY_EMPTY when I call auth.importBotAuthorization.

from telegram-mtproto.

zerobias avatar zerobias commented on June 9, 2024

@wfjsw Can you open the issue and describe the problem in more detail? Ideally, if there will be a code example to reproduce the problem step-by-step

from telegram-mtproto.

wfjsw avatar wfjsw commented on June 9, 2024

@zerobias I will do it soon.
Meanwhile I have updated tl_convert so it parse signed decimel correctly.
And, it seems mtproto schema should never be updated. The L62 schema file occupied from tdesktop is changing every bytes into string in that section which accounts for /æDÚ<¢ issue.

from telegram-mtproto.

goodmind avatar goodmind commented on June 9, 2024

This should be done with https://github.com/zerobias/ties and schema fetcher from tdesktop repo

from telegram-mtproto.

ZAYEC77 avatar ZAYEC77 commented on June 9, 2024

Hello guys

I try to update the schema.
I want to use this file https://tjhorner.com/tl-schema/schema.json as schema.
What should I pass as mtSchema?

I tried to load just one file:

const schema = require('./schema.json')
const client = MTProto({server, api, app, schema})

but got an error:
Encrypted request failed Error: Constructor not found: 2551786849 34875619 34875619.

Thanks

from telegram-mtproto.

terrasoff avatar terrasoff commented on June 9, 2024

what is 57 as layer's value and 0x69796de9?

const api = {
  layer          : 57,
  initConnection : 0x69796de9,
  api_id         : 49631
}

There is no 57 layer in telegram protocol. How does it relate to telegram api layers?
And what is initConnection's value? How to set up it right?

And the major question is how to use latest API with this library? On latest version i get errors like constructor not found while response parse.

from telegram-mtproto.

goodmind avatar goodmind commented on June 9, 2024

#159

from telegram-mtproto.

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.