Telegram Client library

Fast, Enjoyable & Customizable Telegram Client

Pub Version

Telegram client dart library to make application telegram based flutter and userbot / bot support server side and client side

Features

  • 🚀 Cross platform: mobile, desktop, browser, server
  • ⚡ Great performance
  • ❤️ Simple, powerful, & intuitive API

Examples App use Telegram Client

  1. Azkagram

Examples Bot use Telegram Client

  1. AzkadevBot Telegram clone bot and userbot

  1. Free Run User Bot Cloning userbot gratis tanpa server https://user-images.githubusercontent.com/82513502/178153444-5f1a9074-8f43-48c1-bb12-ab1493d17143.mp4

  2. GalaxeusBot Bot Terbaik yang di buat dari orang indonesia complex feature and support payment hexaminate + support clone bot and userbot

  1. Specta-Bot-Telegram Open source bot telegram sekaligus ecosystem dari specta

    Specta
    galaxeus
    Pluggable Telegram Bot

  1. Specta-User-Telegram Open source User telegram sekaligus ecosystem dari specta

    Specta
    galaxeus
    Pluggable Telegram User


Docs

Feature

  • telegram client dart

    • ✅️ support server side & client side
    • ✅️ support multi token ( bot / userbot )
    • ✅️ support bot and userbot
    • ✅️ support telegram-bot-api (local / Bot-Api
    • ✅️ Support long poll update bot api
    • ✅️ Support telegram database library ( TDLIB )
    • ✅️ Add more Api Humanize pretty update and method api humanize
    • ✅️ Easy handle multi client
  • telegram client node

    • ✅️ support server side & client side
    • ✅️ support multi token ( bot / userbot )
    • ✅️ support bot and userbot
    • ✅️ support telegram-bot-api local server
    • ✅️ support telegram database library ( TDLIB )
    • ✅️ Add more Api Humanize pretty update and method api humanize
  • telegram client google apps script

    • ✅️ support multi token ( bot / userbot )
    • ✅️ support bot and userbot
    • ❌️ support telegram-bot-api local server
    • ❌️ support telegram database library ( Tdlib )

To Do

  • X Add Humanize Api Tdlib
  • X Cross platform
  • Example Full Version
  • Mtproto support
  • X Multi Client
  • Example voice call
  • X Tdlib support
  • X Telegram Bot Api Support
  • x Tutorial Video

🔜️ Support Other language code

Dart

Use library

  1. Install Library
dart pub add telegram_client
flutter pub add telegram_client
  1. Build Tdlib

Add library on project

if you make app telegram based this library, you must add native compiled library

Android

Copy .so files from archive to example/android/app/main/jniLibs:

└── example 
    └── android 
        └── app 
            └── main 
                └── jniLibs 
                    └── arm64-v8a
                    │   └── libtdjson.so
                    └── armeabi-v7a
                    │   └── libtdjson.so
                    └── x86
                    │   └── libtdjson.so
                    └── x86_64
                        └── libtdjson.so

Open file example/android/app/build.gradle

replace

sourceSets {
  main.java.srcDirs += 'src/main/kotlin'
}

by

sourceSets {
  main {
    java.srcDirs += 'src/main/kotlin'
    jniLibs.srcDirs = ['src/main/jniLibs']
  }
}

iOS and macOS

  1. Copy libtdjson.dylib from archive to example/ios
  2. Copy libtdjson.dylib from archive to example/macos
└── example 
    └── ios 
    │   └── libtdjson.dylib
    └── macos
        └── libtdjson.dylib
  1. Open Runner.xcworkspace in Xcode.
  2. Add .dylib file to project.
  3. Find Frameworks, Libraries, and EmbeddedContent.
  4. Against libtdjson.dylib choose Embed & Sign.
  5. Find Signing & Capabilities.
  6. In Section App Sandbox (Debug and Profile) set true Outgoing Connections (Client).

Windows

  1. Copy files from archive to example/windows/tdlib
└── example 
    └── windows 
        └── tdlib 
            └── libcrypto-1_1.dll
            └── libssl-1_1.dll
            └── tdjson.dll
            └── zlib1.dll
  1. Open example/windows/CMakeLists.txt.
  2. Add below line set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}"):
# begin td
set(dll_path "${CMAKE_CURRENT_SOURCE_DIR}/tdlib")
install(FILES "${dll_path}/libcrypto-1_1.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)
install(FILES "${dll_path}/libssl-1_1.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)
install(FILES "${dll_path}/tdjson.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)
install(FILES "${dll_path}/zlib1.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)
# end td

Linux

  1. Copy file from archive to example/linux/tdlib
└── example 
    └── linux 
        └── tdlib 
            └── libtdjson.so
  1. Open example/linux/CMakeLists.txt.
  2. Add at the end of file:
# begin td
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/tdlib/libtdjson.so" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
    COMPONENT Runtime)
# end td

Feature

Docs

Tdlib

gunakan ini untuk membuat userbot / bot / application based tdlib, quickstart: more update example check on this

  • single
import 'dart:io';
import 'package:telegram_client/telegram_client.dart';
void main(List<String> args) async {
  var path = Directory.current.path;
  Tdlib tg = Tdlib(path_tdlib:"./tdjson.so", clientOption: {
    'api_id': 12345,
    'api_hash': 'abcdefgjjaijiajdisd',
    'database_directory': "$path/user/",
    'files_directory': "$path/user/",
  });
  tg.on("update", (UpdateTd update) {
    print(update.raw);
  });
  await tg.initIsolate();
}
  • multi
import 'dart:io';
import 'package:telegram_client/telegram_client.dart';
void main(List<String> args) async {
  var path = Directory.current.path;
  Tdlib tg = Tdlib(path_tdlib:"./tdjson.so", clientOption:{
    'api_id': 12345678,
    'api_hash': 'asaskaoskaoskoa',
    'database_directory': "$path/user_0/",
    'files_directory': "$path/user_0/",
  });
  tg.on("update", (UpdateTd update) {
    if (tg.client_id == update.client_id) {
      print("user_0");
    } else {
      print("user_1");
    }
    print(update.raw);
  });
  await tg.initIsolate();
  await tg.initIsolateNewClient(clientId: tg.client_create().address, clientOption: {
    'database_directory': "$path/user_1/",
    'files_directory': "$path/user_1/",
  });
}

constructor

No key value Deskripsi required
1 path_tdlib String path tdlib yes
2 clientOption object parameters di butuhkan jika method membutuhkannya no
  • examples
Tdlib tg = Tdlib(path_tdlib:"./tdjson.so", clientOption: {
  'api_id': 123435,
  'api_hash': 'asmamskmaks',
  'database_directory': "",
  'files_directory': "",
  "use_file_database": true,
  "use_chat_info_database": true,
  "use_message_database": true,
  "use_secret_chats": true,
  'enable_storage_optimizer': true,
  'system_language_code': 'en',
  'new_verbosity_level': 0,
  'application_version': 'v1',
  'device_model': 'Telegram Client Hexaminate',
});

on

No key value Deskripsi required
1 type_update String path tdlib yes
2 function object parameters di butuhkan jika method membutuhkannya yes
  • examples
tg.on("update", (UpdateTd update) {
  print(update.raw);    
});

initIsolate

No key value Deskripsi required
1 clientId int addres client_create no
2 clientOption object parameters di butuhkan jika method membutuhkannya no
  • examples
tg.initIsolate();

request

No key value Deskripsi required
1 name_method String more method check tdlib-docs yes
2 parameters object parameters di butuhkan jika method membutuhkannya options
  • examples
tg.request("sendMessage", parameters: {
  "chat_id": 123456,
  "text": "Hello world"
});

invoke

No key value Deskripsi required
1 parameters object parameters di butuhkan jika method membutuhkannya yes
  • examples
tg.invoke({
  "@type": "getMe",
});

invokeSync

No key value Deskripsi required
1 parameters object parameters di butuhkan jika method membutuhkannya yes
  • examples
tg.invokeSync({
  "@type": "getMe",
});

Object


UpdateTd

raw

raw_api_light

raw_api

message

channel_post


methods

more method check tdlib-docs

sendMessage

No key value Deskripsi required
1 chat_id String or int yes
2 text String yes

sendPhoto

No key value Deskripsi required
1 chat_id String or int yes
2 photo String yes

TelegramBotApi

Gunakan ini untuk berinteraksi dengan api telegram, semua method disini sudah auto update

quickstart:

  • single
import 'package:telegram_client/telegram_client.dart';
void main(List<String> args) async {
  TelegramBotApi tg = TelegramBotApi("token");
  tg.on("update", (UpdateApi update) {
    print(update.raw);
  });
  await tg.initIsolate(); // add this jika ingin menggunakan long poll update
}
  • multi
import 'package:telegram_client/telegram_client.dart';
void main(List<String> args) async {
  TelegramBotApi tg = TelegramBotApi("token");
  tg.on("update", (UpdateApi update) {
    print(update.raw);
  });
  await tg.initIsolate();
  await tg.initIsolate(tokenBot: "new_token_bot");
}

constructor

No key value Deskripsi required
1 string_token_bot String token bot @botfather yes
2 clientOption object parameters di butuhkan jika method membutuhkannya no
  • examples
TelegramBotApi tg = TelegramBotApi("token_bot");
request
No key value Deskripsi required
1 name_method String more method check tdlib-docs yes
2 parameters object parameters di butuhkan jika method membutuhkannya options
  • examples
tg.request("sendMessage", parameters:{
  "chat_id": 123456,
  "text": "Hello world"
});

MtProto

Untuk mtproto telegram ini belum jadi ya karena saya belum mengerti cara connect mtproto Quickstart:

import 'package:telegram_client/telegram_client.dart';
void main() async {
  Mtproto tg = Mtproto();
  tg.connect();
  tg.on("update", (data) {
    print(data);
  });
}
  • Tags: #telegram #telegram_client #tdlib #mtproto #telegram_bot_api #telegram_dart #telegram_flutter #telegram_clone #telegram_userbot #telegram_bot

  • Seo Telegram Dart Telegram Client Telegram Flutter Telegram userbot Telegram Bot Telegram Tdlib Tdlib Mtproto Telegram Bot Api Telegram Library Telegram clone Telegram clone flutter Tdlib Dart Tdlib Flutter Mtproto dart Mtproto flutter Telegram Bot Api Telegram Bot Api dart Telegram Bot Api Flutter


Libraries

telegram_bot_api