Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
committed Jan 25, 2022
1 parent 0d67b51 commit bbaabdc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
Binary file modified dart/telegram_client/bin/bot/td.binlog
Binary file not shown.
2 changes: 1 addition & 1 deletion dart/telegram_client/bin/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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:"));
}
5 changes: 3 additions & 2 deletions dart/telegram_client/bin/testtdlibbot.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:switchscript/switchscript.dart';
import 'package:telegram_client/telegram_client.dart';

void main() {
Expand All @@ -23,15 +24,15 @@ void main() {
"@type": "inputMessageText",
"text": {
"@type": "formattedText",
"text": "hello world",
"text": JSON.stringify(update, null, 2),
"entitiees": []
},
"disableWebPagePreview": false,
"clearDraft": false
}
};
var anu = tdl.clientSend(option);
print(anu);
print(JSON.stringify(anu, null, 2));
}
}
});
Expand Down
20 changes: 5 additions & 15 deletions dart/telegram_client/lib/tdlib/tdlib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Tdlib {

ffi.Pointer<pkgffi.Utf8> Function(ffi.Pointer, ffi.Pointer<pkgffi.Utf8>)
// ignore: non_constant_identifier_names
get _client_execute {
get client_execute {
return TdlibPathFile()
.lookup<
ffi.NativeFunction<
Expand All @@ -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());
Expand Down Expand Up @@ -152,7 +142,7 @@ class Tdlib {
if (authState["@type"] ==
"authorizationStateWaitTdlibParameters") {
var optin = {
'@type': 'setTdlibParameters',
"@type": 'setTdlibParameters',
'parameters': _optionDefault
};
clientSend(optin);
Expand All @@ -166,7 +156,7 @@ class Tdlib {

if (authState["@type"] == "authorizationStateWaitEncryptionKey") {
clientSend({
'@type': 'checkDatabaseEncryptionKey',
"@type": 'checkDatabaseEncryptionKey',
'encryption_key': _optionDefault["database_key"]
});
}
Expand All @@ -176,7 +166,7 @@ class Tdlib {
updateOrigin["state"]["@type"] == "connectionStateReady") {
clientSend({
"@type": "checkAuthenticationBotToken",
"token": ""
"token": "5059078949:"
});
}
callback(updateOrigin);
Expand Down

0 comments on commit bbaabdc

Please sign in to comment.