Comments (25)
@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.
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.
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.
@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.
@terrasoff NEVER believe to official docs
from telegram-mtproto.
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.
@FragsterAt scheme from telegram site is outdated
from telegram-mtproto.
@goodmind ok, but where can I get the actual API documentation?
from telegram-mtproto.
@FragsterAt On official site - nowhere :) But you can look in schema... or we can make docs later
from telegram-mtproto.
It would be great. Let's keep this issue for tracking change request to the docs.
from telegram-mtproto.
@stek29 Wow, great! I found only 57 json schema
from telegram-mtproto.
Looks like we should implement Type Language schema translator
from telegram-mtproto.
@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.
@stek29 It would be great) Python isn't a problem
from telegram-mtproto.
@stek29 thanks!
from telegram-mtproto.
@wfjsw Is something wrong? Scheme looks well
from telegram-mtproto.
@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.
@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.
@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.
@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.
@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.
This should be done with https://github.com/zerobias/ties and schema fetcher from tdesktop repo
from telegram-mtproto.
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.
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.
from telegram-mtproto.
Related Issues (20)
- Flood wait! HOT 3
- How to get all dialogs?
- 401 AUTH_KEY_UNREGISTERED right after authorization HOT 1
- Working version support file downloading HOT 1
- AUTH_KEY_DUPLICATED
- get all the chats, not just channels
- please! need working version that works with real DCs and can somehow watch for new messages. HOT 1
- add ability to call "auth.sendCode" and "auth.signIn" from different instances of telegram-mtproto
- Try/catch doesn't work HOT 3
- messages.addChatUser
- New Telegram API Schema HOT 2
- Saving auth data in localstorage HOT 1
- PHONE_NUMBER_FLOOD
- Version 3.2.11 no any answer
- 我第二次使用API进行登陆后,返回了 error 400 PHONE_NUMBER_BANNED ,我没有做其他的操作啊 不知道为什么 HOT 2
- messages.getDialogs does not work in beta nor alpha
- USERNAME_INVALID contacts.resolveUsername
- messages.readHistory for inputPeerChannel gives Error
- How to get updates from telegram (to get new messages)? HOT 1
- upload.getFile()
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 telegram-mtproto.