Urgent Assistance Needed: Telethon Project Not Functioning Properly on Replit

Dear Replit Support Team,

I hope this message finds you well. I am writing to seek urgent assistance with an issue I am experiencing with my Telethon project on the Replit platform. My project aims to make a fully working telegram bot. However, I am facing persistent difficulties in getting the project to function reliably.

The problem arises specifically during the initialization of the “TelegramClient” in my Python code. The expected behavior is that the program prompts for a phone number and a received code through personal messages on Telegram. However, when the code reaches this point, nothing happens. The program does not ask for the necessary authentication details.

What adds to the complexity of the issue is that the project exhibits intermittent behavior. It runs successfully for approximately two weeks but then fails to start for about a week. It’s worth noting that I have tested the project locally, and it runs without any issues in that environment. Therefore, I believe the problem lies within the Replit platform itself.

To resolve this critical problem and ensure the program operates reliably, I kindly request your expertise and guidance. Here are the specific details you may need to assist me effectively:

  1. Replit Project Name: TELETHON-MUILTIBOT-ALPHA-V1.5
  2. Language and Framework: Python with Telethon library
  3. Code Snippet:
from telethon import TelegramClient, events

# Set up your Telegram API credentials
api_id = 'your_api_id'
api_hash = 'your_api_hash'

# Create a TelegramClient instance
client = TelegramClient('session_name', api_id, api_hash)


@client.on(events.NewMessage(pattern='/start'))
async def start(event):
    # Handle the /start command
    await event.respond('Welcome to the bot!')


@client.on(events.NewMessage(pattern='/hello'))
async def hello(event):
    # Handle the /hello command
    await event.respond('Hello there!')


# Run the client
client.start()
client.run_until_disconnected()

I would greatly appreciate it if you could investigate the issue at the earliest convenience and provide any insights or solutions to resolve the problem. Given the importance of this program in improving Telegram accessibility, your prompt attention is highly valued.

Thank you very much for your assistance. I look forward to hearing from you soon.

Sincerely,
Mike Walter

try after running kill 1 in Shell :man_shrugging:

2 Likes

Thank you very much for the reply to my post. The problem is still there even after running kill 1 and then python main.py
I hope there is solution for this soon.

Hi @MikeWalter , telegram bots do not work on Replit now due to DoS protection.

Thanks for the information @NateDhaliwal is there a way to get it to work like reverse Proxy technique or something else.

Proxies are not allowed or not encouraged on Replit. Try VS Code?

It’s Running fine locally in my pc environment. But in my repl the whole library (telethon) is not working.