tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

get error 400 in setting parameters #2951

Closed mikeMclasky closed 3 months ago

mikeMclasky commented 4 months ago

I have problem in setting Tdlib parameters. I'm using 1.8.29 version of tdlib my initialize parameters:

TdClient Client = new TdClient();
byte[] encryptionKey = new byte[32];
new Random().NextBytes(encryptionKey);
var request = new TdApi.SetTdlibParameters
{
    UseTestDc = false,
    DatabaseDirectory = Path.Combine("test", "TdTelegram"),
    FilesDirectory = Path.Combine("test", "TdTelegram"),
    DatabaseEncryptionKey = encryptionKey,
    UseFileDatabase = true,
    UseChatInfoDatabase = false,
    UseMessageDatabase = true,
    UseSecretChats = true,
    ApiId = _apiId,
    ApiHash = _apiHash,
    SystemLanguageCode = "en",
    DeviceModel = "Desktop",
    SystemVersion = "5.1.7",
    ApplicationVersion = "1.0.0"
};
await Client.ExecuteAsync(request);

in the log i have encounter with error 400:

[ 3][t 4][1719735119.923419713][Td.cpp:4252][#1][!Td][&td_requests] Sending result for request 2: ok { } [ 3][t 0][1719735119.923613309][Client.cpp:286][&td_requests] End to wait for updates, returning object 2 000001D77ACF3520 [ 3][t 0][1719735119.923957347][Client.cpp:278][&td_requests] Begin to wait for updates with timeout 0.100000 [ 3][t 4][1719735119.958036422][Td.cpp:3072][#1][!Td][&td_requests] Receive request 3: setTdlibParameters { parameters = null } [ 3][t 4][1719735119.958441734][Td.cpp:4266][#1][!Td][&td_requests] Sending error for request 3: error { code = 400 message = "Parameters aren't specified" }

levlam commented 4 months ago

You pass a new object to an old TDLib version. Check getOption("version").

mikeMclasky commented 4 months ago

@levlam Hi, getoption is not exists in this version. i use below code and return nothing and get stuck. await TdApi.GetOptionAsync(Client,"version");

i can confirm version 1.8.29 for TdLib and TdApi in Nuget package manager

levlam commented 4 months ago

The response if from a much older TDLib version.

mikeMclasky commented 4 months ago

@levlam What?

levlam commented 4 months ago

The response "Parameters aren't specified" is from a very old TDLib version, which is definitely not TDLib 1.8.29. You can see the exact version in the log.

mikeMclasky commented 3 months ago

@levlam Yes, you are right. The dll file of tdlib was not update. Thank you.