telegram_client 0.0.6 telegram_client: ^0.0.6 copied to clipboard
telegram client library to make bot or userbot Support Telegram Api and Support Tdlib Telegram Database Library.
LOCALDB
Telegram Bot api dart library auto update from official Telegram-Bot-Api, Support All Method Api.
Welcome to Azkadev's profile!
I'm Gibran Alazka, a freshman at THU.
- ⚒ Javascript / Dart / C++
- ✏️ Ubuntu
- 🌱 Taking courses & doing assignments at THU
- 👨 Pronouns: he/him
📃 My Skilss:
I'm Gibran Alazka, a freshman at THU.
- ⚒ Javascript / Dart / C++
- ✏️ Ubuntu
- 🌱 Taking courses & doing assignments at THU
- 👨 Pronouns: he/him
My Social Media
#
Donate #
ID: Jika Anda Menyukai karya saya dan ingin memberikan dana untuk saya membeli beberapa snack silahkan donasi seberapapun itu akan saya terima dan terima kasih banyak ya.
EN: If you like my work and want to give me funds to buy some snacks, please donate any amount I will accept and thank you very much.
Framework #
ID: Project ini Menggunakan beberapa bahasa framework sebagai berikut.
EN: This project uses several framework as follows.
Language Code #
ID: Project ini Menggunakan beberapa bahasa code program sebagai berikut.
EN: This project uses several programming language languages as follows.
Use This Library #
ID: untuk anda yang ingin mencoba menggunakan source code ini, silahkan ikuti step berikut ini :
EN: for those of you who want to try to using this source code, please follow these steps :
Install Library
dart pub add telegram_client
Quickstart #
- Apps
- Test Tdlib
import 'package:telegram_client/telegram_client.dart';
void main() {
var option = {
'api_id': 1917085,
'api_hash': 'a612212e6ac3ff1f97a99b2e0f050894',
'database_directory':"/home/azkadev/Documents/telegram_client/dart/telegram_client/bin/bot",
'files_directory': "/home/azkadev/Documents/telegram_client/dart/telegram_client/bin/bot"
};
var tdl = Tdlib("/home/azkadev/Desktop/azkauserrobot/libtdjson.so", option);
tdl.on((update, client) {
if (update["@type"] == "updateNewMessage" &&
update["message"]["@type"] == "message") {
var msg = update["message"];
var chatId = msg["chat_id"];
if (!msg["is_outgoing"]) {
var option = {
"@type": "sendMessage",
"chat_id": chatId,
"input_message_content": {
"@type": "inputMessageText",
"text": {
"@type": "formattedText",
"text": "hello world",
"entitiees": []
},
"disableWebPagePreview": false,
"clearDraft": false
}
};
return tdl.clientSend(option);
}
}
});
tdl.clientSend({
"@type": "checkAuthenticationBotToken",
"token": "token_your_bot"
});
}
- Test Cli Telegram Api
import 'package:telegram_client/telegram_client.dart';
import 'dart:io';
void main() async {
stdout.write("Paste your token bot from @botfather here: ");
var tokenBot = stdin.readLineSync().toString();
if (tokenBot.isNotEmpty) {
var tg = Telegram(tokenBot);
stdout.write("Enter your chat_id : ");
var chatId = stdin.readLineSync();
if (chatId.toString().isNotEmpty) {
// ignore: non_constant_identifier_names
var chat_id = chatId;
// request raw auto update library latest
var options = {
"chat_id": chat_id,
"document": tg.api.file(
"/home/azkadev/Documents/telegram_client/dart/telegram_client/docs/README.md"),
"caption": "hello world",
"protect_content": true,
"reply_markup": {
"inline_keyboard": [
[
{"text": "form data nih bos", "url": "google.com"}
]
]
}
};
try {
try {
await tg.api.request("sendDocument", options, true);
} catch (e) {
print("eror");
}
await tg.api.sendMessage(chat_id, "hello world", {
"reply_markup": {
"inline_keyboard": [
[
{"text": "hewlo", "url": "google.com"}
]
]
}
});
var request = await tg.api.request("getMe");
print(request);
} catch (e) {
try {
await tg.api.sendMessage(chat_id, e.toString());
} catch (e) {
print(e);
}
}
} else {
print("silahkan ulangin lagi dari awal");
}
} else {
print("silahkan ulangin lagi dari awal");
}
}