Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
committed Nov 25, 2022
1 parent d8e95a2 commit 84125fa
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 105 deletions.
3 changes: 3 additions & 0 deletions dart/telegram_client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.3.74
- remove depends

## 0.3.73
- now you can easy send file without add param is_form in telegram bot api

Expand Down
193 changes: 105 additions & 88 deletions dart/telegram_client/lib/tdlib/tdlib.dart

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,15 @@ class TelegramBotApi {
/// ```dart
/// tg.file("./doc.json"),
/// ```
Map file(path, [var option]) {
Map file(path, [Map<String, dynamic> option = const <String, dynamic>{}]) {
Map<String, dynamic> jsonData = {"is_post_file": true};
if (RegExp(r"^(./|/)", caseSensitive: false).hasMatch(path)) {
var filename = path
.toString()
.replaceAll(RegExp(r"^(./|/)", caseSensitive: false), "");
jsonData["file_name"] = filename;
jsonData["file_path"] = path;
if (typeData(option) == "object") {
jsonData.addAll(option);
}
jsonData.addAll(option);
} else {
jsonData["is_post_file"] = false;
jsonData["file_path"] = path;
Expand Down
4 changes: 2 additions & 2 deletions dart/telegram_client/lib/telegram_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ library telegram_client;

import 'dart:async';
import 'dart:convert' as convert;
import 'package:http/http.dart';
import 'package:hexaminate/hexaminate.dart';
import 'dart:convert';
import 'package:galaxeus_lib/galaxeus_lib.dart';
import 'package:telegram_client/telegram_client.dart';
import 'package:universal_io/io.dart';
export 'tdlib/ffi/tdlib.dart' if (dart.library.html) 'tdlib/ffi/tdlib_web.dart';
Expand Down
66 changes: 66 additions & 0 deletions dart/telegram_client/lib/util/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,70 @@ class TgUtils {
}
return listOffset;
}

static bool getBoolean(dynamic data) {
if (data == null) {
return false;
}
if (data is String) {
if (data.isNotEmpty) {
return true;
} else {
return false;
}
} else if (data is Map) {
if (data.isEmpty) {
return true;
} else {
return false;
}
} else if (data is List) {
if (data.isNotEmpty) {
return true;
} else {
return false;
}
} else if (data is int) {
if (data < 0) {
return true;
} else if (data.isOdd) {
return true;
} else {
return false;
}
}
if (data is bool) {
return data;
} else {
return false;
}
}
}

class Buffer {
static String base64 = "base64";
static String utf8 = "utf8";
static Encode from(String data, [String type = "utf8"]) {
return Encode(data, type);
}
}

class Encode {
String text;
String type;
Encode(this.text, this.type);

String toStringEncode(String typeEncode) {
if (RegExp(r"^utf8$", caseSensitive: false).hasMatch(type)) {
if (RegExp(r"^base64$", caseSensitive: false).hasMatch(typeEncode)) {
return base64.encode(utf8.encode(text));
}
}
if (RegExp(r"^base64$", caseSensitive: false).hasMatch(type)) {
if (RegExp(r"^utf8$", caseSensitive: false).hasMatch(typeEncode)) {
return utf8.decode(base64.decode(text));
}
}
return text;
}
}
7 changes: 0 additions & 7 deletions dart/telegram_client/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.28"
hexaminate:
dependency: "direct main"
description:
name: hexaminate
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
http:
dependency: "direct main"
description:
Expand Down
7 changes: 3 additions & 4 deletions dart/telegram_client/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: telegram_client
description: Telegram Client Lightweight, blazing and Highly customizable for make application telegram based tdlib, mtproto, or bot api and support server side.
version: 0.3.73
homepage: https://github.com/azkadev/telegram_client/wiki
version: 0.3.74
homepage: https://youtube.com/@azkadev
repository: https://github.com/azkadev/telegram_client/tree/main/dart/telegram_client
issue_tracker: https://github.com/azkadev/telegram_client/issues
# publish_to: none
Expand All @@ -16,11 +16,10 @@ dependencies:
# galaxeus_lib:
# path: /home/hexaminate/Documents/HEXAMINATE/app/galaxeus/packages/dart/galaxeus_lib/
galaxeus_lib: ^0.0.28
hexaminate: ^0.1.4
http: ^0.13.4
path: ^1.8.2
universal_io: ^2.0.4
web_ffi: ^0.7.2

executables:
tg_cli: tg_cli
tg: tg_cli

0 comments on commit 84125fa

Please sign in to comment.