Replit cannot start a telegram bot

Question: Why can’t Replit start a telegram bot?

Repl link: Start a bot

For almost a week now Replit can’t run the simplest code, which starts an empty telegram bot (library is telethon).

client = TelegramClient(name, api_id, api_hash).start(bot_token=bot_token)

It either just freezes without any response or gives a bunch of mistakes like:

asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 8 expected bytes
Server closed the connection: 0 bytes read on a total of 8 expected bytes

Locally everything runs fine. I double checked the api_id, api_hash and bot_token.

I have been using Replit to run telegram bots for more than 2 months, but now something seems to have broken.

Try updating the telethon library by running the command python3 -m pip install --upgrade telethon.

It didn’t work (and telethon was up to date). I then additionally tried to upgrade pip, and now this line actually gives a mistake.

An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache').

Hello and welcome to Ask @grammar-anarchi!

Since this is a pip configuration error, try:

Then run the pip install again.

1 Like

Thank you, that worked with this minor issue.

However, the original problem is still there.

1 Like

I think this is related to a wider issue because of how replit handles outgoing connections, see this:

A few posts below that says this includes all programs/libraries that interact with Telegram.