diff --git a/dart/telegram_client/bin/bot/td.binlog b/dart/telegram_client/bin/bot/td.binlog index cc708f8b..e4396a6d 100644 Binary files a/dart/telegram_client/bin/bot/td.binlog and b/dart/telegram_client/bin/bot/td.binlog differ diff --git a/dart/telegram_client/bin/test.dart b/dart/telegram_client/bin/test.dart index d2d49e1f..9e33ab82 100644 --- a/dart/telegram_client/bin/test.dart +++ b/dart/telegram_client/bin/test.dart @@ -2,5 +2,5 @@ import 'package:switchscript/switchscript.dart'; import 'package:telegram_client/telegram_client.dart'; void main() { - print(typeData(null)); + print({"_" : "azka", "chat_id": "SAs", "state": {"@type":"Sas"}}.toString().replaceAll("_:", "@type:")); } diff --git a/dart/telegram_client/bin/testtdlibbot.dart b/dart/telegram_client/bin/testtdlibbot.dart index 18473840..7433de11 100644 --- a/dart/telegram_client/bin/testtdlibbot.dart +++ b/dart/telegram_client/bin/testtdlibbot.dart @@ -1,3 +1,4 @@ +import 'package:switchscript/switchscript.dart'; import 'package:telegram_client/telegram_client.dart'; void main() { @@ -23,7 +24,7 @@ void main() { "@type": "inputMessageText", "text": { "@type": "formattedText", - "text": "hello world", + "text": JSON.stringify(update, null, 2), "entitiees": [] }, "disableWebPagePreview": false, @@ -31,7 +32,7 @@ void main() { } }; var anu = tdl.clientSend(option); - print(anu); + print(JSON.stringify(anu, null, 2)); } } }); diff --git a/dart/telegram_client/lib/tdlib/tdlib.dart b/dart/telegram_client/lib/tdlib/tdlib.dart index c3146fe4..c200f212 100644 --- a/dart/telegram_client/lib/tdlib/tdlib.dart +++ b/dart/telegram_client/lib/tdlib/tdlib.dart @@ -87,7 +87,7 @@ class Tdlib { ffi.Pointer Function(ffi.Pointer, ffi.Pointer) // ignore: non_constant_identifier_names - get _client_execute { + get client_execute { return TdlibPathFile() .lookup< ffi.NativeFunction< @@ -103,17 +103,7 @@ class Tdlib { 'td_json_client_destroy') .asFunction(); } - - invokeSync(client, jsonobject) { - var fetch = - _client_execute(client, convert.json.encode(jsonobject).toNativeUtf8()); - return convert.json.decode(fetch.toDartString()); - } - - invoke(Object? value) { - _client_send(client, convert.json.encode(value).toNativeUtf8()); - return _client_receive(client, 1.0).toDartString(); - } + Map clientSend(jsonsend) { _client_send(client, convert.json.encode(jsonsend).toNativeUtf8()); @@ -152,7 +142,7 @@ class Tdlib { if (authState["@type"] == "authorizationStateWaitTdlibParameters") { var optin = { - '@type': 'setTdlibParameters', + "@type": 'setTdlibParameters', 'parameters': _optionDefault }; clientSend(optin); @@ -166,7 +156,7 @@ class Tdlib { if (authState["@type"] == "authorizationStateWaitEncryptionKey") { clientSend({ - '@type': 'checkDatabaseEncryptionKey', + "@type": 'checkDatabaseEncryptionKey', 'encryption_key': _optionDefault["database_key"] }); } @@ -176,7 +166,7 @@ class Tdlib { updateOrigin["state"]["@type"] == "connectionStateReady") { clientSend({ "@type": "checkAuthenticationBotToken", - "token": "" + "token": "5059078949:" }); } callback(updateOrigin);