Forums

Want to use local Telegram Bot API server...

When I follow the instruction git clone --recursive https://github.com/tdlib/telegram-bot-api.git cd telegram-bot-api rm -rf build mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. cmake --build . --target install

I have an error

Traceback (most recent call last): File "/home/XXXXX/.local/bin/gperf", line 5, in <module> from gperf.gperf import main File "/home/XXXXX/.local/lib/python3.10/site-packages/gperf/gperf.py", line 50 print "%s: '%s'" % (e.strerror, e.filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? make[2]: *** [td/tdutils/generate/CMakeFiles/tdmime_auto.dir/build.make:62: ../td/tdutils/generate/auto/mime_type_to_extension.cpp] Error 1 make[2]: *** Deleting file '../td/tdutils/generate/auto/mime_type_to_extension.cpp' make[1]: *** [CMakeFiles/Makefile2:863: td/tdutils/generate/CMakeFiles/tdmime_auto.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

What's the problem with gperf??

You are trying to use a module that was written in Python 2 in Python 3, so it will not work.

Thanks a lot! You're right! ( but what I have to do now? not a clue

Have a look at the docs for the package, maybe there are alternatives/ports for Python 3; alternatively, Python 2 is still available on PythonAnywhere.

Hi Could you pls write exactly how you managed (if so) to start and run the local server?

So they provide this build for ubuntu 20 on g++, with install to usr/local:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++
git clone --recursive https://github.com/tdlib/telegram-bot-api.git
cd telegram-bot-api
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
cmake --build . --target install
cd ../..
ls -l /usr/local/bin/telegram-bot-api*

So as far as I've read, it's not possible to use sudo and apt-get directly.

That install process will probably not work on PythonAnywhere.

So, appears that it works with some premutations. I managed to install everything required and build the server. But now I encounter another issue, don't know if it's server build or I just dont get it..

So after running server, all IP adresses I try to pass to bot as API_URL give 404 error. descpite its 0.0.0.0:8081 or 10.0.026:8081, or other ports, it just cant connect to it.

after listing all listening tcp ports in bash console, there are particularly different IP's, but the only one that somehow works is 10.0.0.226:53 It looks like it's successfuly activated the bot, but then I recevie read timeout error. So as I understand it is correct IP, but maybe incorrect port? By default telegram-bot-api listening port is 8081, maybe I should set it to 53?

What and where from is trying to connect to your server?

Hello. I already managed to correctly run everything, so im using telebot to operate my telegram bot, and telegram bot api server build to build local server for it.

Then telebot is calling all its methods, but it's API_ULR is initially changed to local server IP, which is 0.0.0.0:8081.

Now all functionality works as expected and it is pretty astonishing, to have possibility to do this on PA.

Not sure how stable it could be, but it's interesting. Blog about it :)

Dear Applemug! How you've managed to install everything required? and build the server on PA? Step-by-step plz!! 'Cause it still not working (

Hello guys!
So, I did create a separate topic on this, you can find it here:

How to build and start telegram bot api local server (instructions)

Note: I am just a beginner learning how to code and i am not a server expert, so it may not be great guide. But i hope it will help.

Great! Thanks a lot )

Interesting. Thanks for sharing!