Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error {code = 400 message = "Failed to parse JSON object as TDLib request: Can't parse "<bot_id_string>" as an integer"} #209

Open
Marty-Stu opened this issue Jul 8, 2022 · 0 comments

Comments

@Marty-Stu
Copy link

Marty-Stu commented Jul 8, 2022

Issue type:

[x] question
[ ] bug report
[ ] feature request
[ ] documentation issue

Airgram version:

[x] latest
[ ] @next
[ ] 2.3.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

  1. Windows 10 Pro x64

  2. WSL2 Debian

$ cat /etc/issue
Debian GNU/Linux 11 \n \l
  1. node + npm versions
$ node -v && npm -v
v18.1.0
8.8.0

3.1. npm install ...

$ npm install --save airgram
$ npm install --save node-gyp

3.2. package.json

    "dependencies": {
        "airgram": "^5.0.0",
        "node-gyp": "^9.0.0"
      },

3.3. libtdjson.so.1.8.0
~/nodejs/airgram/libtdjson.so
https://github.com/tdlib/td#building
https://tdlib.github.io/td/build.html?language=JavaScript

su -
apt-get update
apt-get upgrade
apt-get install make git zlib1g-dev libssl-dev gperf php-cli cmake clang libc++-dev libc++abi-dev
exit

cd ~/nodejs/airgram/
git clone https://github.com/tdlib/td.git
cd td
rm -rf build
mkdir build
cd build
CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib ..
cmake --build . --target install
cd ..
cd ..
ls -l td/tdlib
$ ls ~/nodejs/airgram/libtdjson.so
/home/user/nodejs/airgram/libtdjson.so

3.4. const airgram = new Airgram(); airgram.use(new Auth({token: BOT_TOKEN}));

$ cat ~/nodejs/airgram/index.js
import { BOT_TOKEN, BOT_ID, BOT_HASH, TDLIB_COMMAND } from './config.js';
import { Airgram } from 'airgram';

const airgram = new Airgram({apiId: BOT_ID, apiHash: BOT_HASH});

airgram.use(new Auth({token: BOT_TOKEN}));

3.5. start script

$ node index.js
[ 3][t 0][1657275934.974021196][Client.cpp:281][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 4][1657275934.978097915][Td.cpp:2670][#1][!MultiTd]      Create Td with layer 143, database version 13 and version 41 on 4 threads
[ 3][t 4][1657275934.978206157][Td.cpp:4156][#1][!Td][&td_requests]     Sending update: updateOption {
  name = "version"
  value = optionValueString {
    value = "1.8.4"
  }
}
[ 3][t 4][1657275934.978314161][Td.cpp:4156][#1][!Td][&td_requests]     Sending update: updateAuthorizationState {
  authorization_state = authorizationStateWaitTdlibParameters {
  }
}
[ 3][t 0][1657275934.978333950][Client.cpp:294][&td_requests]   End to wait for updates, returning object 0 0x7efefc101ae0
[ 3][t 4][1657275934.978373289][Td.cpp:3033][#1][!Td][&td_requests]     Receive request 1: getOption {
  name = "version"
}
[ 3][t 0][1657275934.995565176][Client.cpp:281][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1657275934.995647192][Client.cpp:294][&td_requests]   End to wait for updates, returning object 0 0x7efefc101c00
[ 3][t 4][1657275935.005775928][Td.cpp:3033][#1][!Td][&td_requests]     Receive request 2: testReturnError {
  error = error {
    code = 400
    message = "Failed to parse JSON object as TDLib request: Can't parse "<BOT_ID>" as an integer"
  }
}
[ 3][t 4][1657275935.005839109][Td.cpp:3176][#1][!Td][&td_requests]     Receive static request: testReturnError {
  error = error {
    code = 400
    message = "Failed to parse JSON object as TDLib request: Can't parse "<BOT_ID>" as an integer"
  }
}
[ 3][t 4][1657275935.005850315][Td.cpp:3184][#1][!Td][&td_requests]     Sending result for static request: error {
  code = 400
  message = "Failed to parse JSON object as TDLib request: Can't parse "<BOT_ID>" as an integer"
}
[ 3][t 4][1657275935.005903959][Td.cpp:4171][#1][!Td][&td_requests]     Sending result for request 2: error {
  code = 400
  message = "Failed to parse JSON object as TDLib request: Can't parse "<BOT_ID>" as an integer"
}
[ 3][t 0][1657275935.006094217][Client.cpp:281][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1657275935.006155014][Client.cpp:294][&td_requests]   End to wait for updates, returning object 2 0x7f01a9517b00
[ 3][t 0][1657275935.015649080][Client.cpp:281][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1657275945.025886058][Client.cpp:294][&td_requests]   End to wait for updates, returning object 0 (nil)
[ 3][t 0][1657275945.026395082][Client.cpp:281][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1657275955.029754877][Client.cpp:294][&td_requests]   End to wait for updates, returning object 0 (nil)
[ 3][t 0][1657275955.030821323][Client.cpp:281][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1657275965.041028261][Client.cpp:294][&td_requests]   End to wait for updates, returning object 0 (nil)
[ 3][t 0][1657275965.041658878][Client.cpp:281][&td_requests]   Begin to wait for updates with timeout 10.000000
  1. tell me please what could be wrong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant