oott123 / tdlib-json-cli

A CLI Wrapper of TdLib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TDLib JSON CLI

TDLib v1.7.10 GitHub release TDLib Linux AGPL v3.0 Twitter

About

TDLib JSON CLI is a simple command line tool uses stdin & stdout as input & output of tdlib's td_json_client.

You can use this to replace the buggy, weird tg-cli and it's json interface.

This project is licensed under AGPL v3.0, but you can distribute it separately so you are not required to make your project open source under AGPL compatible license.

Usage

./bin/tdlib-json-cli [verbosity]

[verbosity] = 0123456789 Set TDLib's verbosity level at startup.

  • 0 - fatal errors;
  • 1 - errors;
  • 2 - warnings and debug warnings;
  • 3 - informational;
  • 4 - debug;
  • 5 - verbose debug;
  • greater than 5 and up to 1024 can be used to enable even more logging.

tdlib-json-cli will use stdin & stdout to process data.

Request will be send to tdlib line by line, so make sure you have your json string in one line.

Response will be recieve from tdlib to stdout line by line.

See TDLib Documention for more information.

Commands

We provide 2 extra command to control tdlib-json-cli behaviors.

verbose [int]

Change the verbose level of the tdlib.

exit

exit the tdlib-json-cli.

Events

We provide serveral events for you to know tdlib-json-cli status.

They are json strings which write to stdout like {"@cli":{"event":"EVENT_ID"}}.

client_created

This event will be trigged at td client created.

exited

This event will be trigged at tdlib-json-cli exited.

Build

macOS

brew install gperf cmake openssl readline
mkdir Release
cd Release
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ -DREADLINE_INCLUDE_DIR=/usr/local/opt/readline/include -DREADLINE_LIBRARY=/usr/local/opt/readline/lib/libreadline.dylib -DCMAKE_BUILD_TYPE=Release ..
make -j4

Linux

See td/README.md

Windows

See td/README.md

Generate Types File

You should have php, doxygen and ruby installed.

Before generate types file, you MUST build successfully at least one time. This because of some code of tdlib which used to generate docs and are generated at the build time.

cd td
doxygen
cd ../types-generator
bundle install
bundle exec rake

This will write types.json to the project root directory which contains types of all the objects and functions.

About

A CLI Wrapper of TdLib

License:GNU Affero General Public License v3.0


Languages

Language:Ruby 63.9%Language:C++ 27.0%Language:CMake 9.1%