Total Pageviews

Monday 27 April 2020

基于java的Telegram客户端程序Deepthought

Telegram Client written in Java to support multiple custom implementations.

Contributions

Feel free to fork this project, work on it and then make a pull request to dev branch.

Telegram API implementation

This project is using the implementation present at TelegramApi project

Adding new plugins

Make a pull request with the new plugin. Please follow these rules:
  1. Add the plugin under plugins package in its own package.
  2. Don't make a plugin dependent on a different one.
  3. A nice description of the plugin is welcome inside the package in a file called Plugin.md
Please, DO NOT PUSH ANY API KEY OR API HASH, I will never accept a pull request with that content.

Usage

Current Deepthought.java has a example of usage with echo bot, to run it you need a couple of steps first
  1. In Deepthought.java, set up your own APIKEY and APIHASH. You can get them here
  2. In DatabaseConstants.java, set up your database configuration (database name, user, password). Currently the code support mysql databases.
In any case, this is the things that needs to be done before using it:
  1. In Deepthought.java, set up your own API_KEY and API_HASH. You can get them here
  2. In the plugin you want to build, create your own class that extends UpdatesHandlerBase.java (or DefaultUpdatesHandler.java if you only need a simpler version). This will be in charge of handling every update received.
  3. In the plugin you want to build, create your own class that implements ChatUpdatesBuilder.java. This builder must be the one in charge of creating the unique instance of your previous handler.
  4. For building points 2 and 3, you are gonna need a DatabaseManager implementation (this doesn't need to have a real database behind it, but it must be able to store chatsusers and differences data somewhere so the client works correctly.
  5. In Deepthought.java build your own BotConfig with your phone number (remember that it must be in international format +1XXXXXXXXX, but without the + symbol) and the name of the auth file where the session must be stored. Then build your own ChatUpdatesBuilder implementation and finally create your own TelegramBot.java and call its methods init and startBot.
  6. It should start working.

Example bots

Create your own stickers with Clippy

Telegram API and MTPROTO:

If you want more information about Telegram API, you can go here. And here you will find extra information about mtproto.

Questions or Suggestions

Feel free to create issues here as you need.

No comments:

Post a Comment