All Projects → Arman92 → go-tl-parser

Arman92 / go-tl-parser

Licence: GPL-3.0 license
Generates JSON or Go structs/methods of a Telegram .tl file

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to go-tl-parser

tdlib-binaries
prebuilt TDLib binaries
Stars: ✭ 26 (+52.94%)
Mutual labels:  tdlib, tdjson
node-tdlib
TDLib Binding with Telegram Bot API Reimplemention for Node.js
Stars: ✭ 35 (+105.88%)
Mutual labels:  tdlib
kotlogram2
An convinient wrapper for kotlogram
Stars: ✭ 17 (+0%)
Mutual labels:  tdlib
TGCopyBot
A python script to copy telegram messages to another chat (without forwarding)
Stars: ✭ 67 (+294.12%)
Mutual labels:  tdlib
tdlight-java
Complete Bot and Userbot Telegram library based on TDLib
Stars: ✭ 128 (+652.94%)
Mutual labels:  tdlib
python-tdlib
full oop python 3 tdlib wrapper, fast, thread safe
Stars: ✭ 20 (+17.65%)
Mutual labels:  tdlib
aiotdlib
Python asyncio Telegram client based on TDLib https://github.com/tdlib/td
Stars: ✭ 63 (+270.59%)
Mutual labels:  tdlib
Pyrogram
Telegram MTProto API Client Library and Framework in Pure Python for Users and Bots
Stars: ✭ 2,252 (+13147.06%)
Mutual labels:  tdlib
node-tg-native
Telegram Native lib
Stars: ✭ 22 (+29.41%)
Mutual labels:  tdlib
meegram2
Telegram client for Nokia N9 (used tdlib)
Stars: ✭ 16 (-5.88%)
Mutual labels:  tdlib
gotgproto
A helper package for Go Telegram Client, i.e. gotd/td.
Stars: ✭ 32 (+88.24%)
Mutual labels:  tdlib
polaris.py
A multiplatform Python bot using plugins!
Stars: ✭ 19 (+11.76%)
Mutual labels:  tdlib
telegram client
library for help you make userbot or bot telegram and support tdlib telegram database and only support nodejs dart and google-apps-script
Stars: ✭ 38 (+123.53%)
Mutual labels:  tdlib
TelegramExample
A telegram client for android created using tdlib library and built with Jetpack Compose
Stars: ✭ 35 (+105.88%)
Mutual labels:  tdlib
telegram-nearby-map
Discover the location of nearby Telegram users 📡🌍
Stars: ✭ 329 (+1835.29%)
Mutual labels:  tdlib
tdlight-telegram-bot-api
The TDLight Telegram Bot API is an actively enhanced fork of the original Bot API, featuring experimental user support, proxies, unlimited files size, and more.
Stars: ✭ 71 (+317.65%)
Mutual labels:  tdlib

go-tl-parser

Generates JSON or Go structs/methods of a Telegram .tl file Adds every single comment (Structs, Struct members, Methods, Method arguments)

Proof of concept

Here is class defined in Type Language:

//@description The message was originally a post in a channel @chat_id Identifier of the chat from which the message was forwarded @author_signature Post author signature
//@date Point in time (Unix timestamp) when the message was originally sent @message_id Message identifier of the original message from which the new message was forwarded; 0 if unknown
//@forwarded_from_chat_id For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown
//@forwarded_from_message_id For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded; 0 if unknown
messageForwardedPost chat_id:int53 author_signature:string date:int32 message_id:int53 forwarded_from_chat_id:int53 forwarded_from_message_id:int53 = MessageForwardInfo;

Here is the autogenerated go struct:

// MessageForwardedPost The message was originally a post in a channel
type MessageForwardedPost struct {
	tdCommon
	MessageID              int64  `json:"message_id"`                // Message identifier of the original message from which the new message was forwarded; 0 if unknown
	ForwardedFromChatID    int64  `json:"forwarded_from_chat_id"`    // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown
	ForwardedFromMessageID int64  `json:"forwarded_from_message_id"` // For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded; 0 if unknown
	ChatID                 int64  `json:"chat_id"`                   // Identifier of the chat from which the message was forwarded
	AuthorSignature        string `json:"author_signature"`          // Post author signature
	Date                   int32  `json:"date"`                      // Point in time (Unix timestamp) when the message was originally sent
}

Usage

Install by running:

$ go get github.com/Arman92/go-tl-parser

Run by:

$ go-tl-parser file=./schema.tl dir=./tdlib package=tdlib structs-file=types.go methods-file=methods.go

This work is used in Telegram Tdlib go binding project, used to generate types and functions from .tl schema file, so you may want to change the code to meet your needs.

Files under tdlib folder are autogenerated (except tdjson.go which is only there for error-free compliation)

Credits for basic c-bindings goes to go-tdjson

Type Language .tl schema for tdlib can be found here

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].