0

In my bot made with pyrogram, I wrote a code that asks the user to answer the messages after 60 seconds with asyncio sleep, but if too many people trigger this code, my bot does not receive any command until any of these waiting processes are over, how can I solve this problem?

My code:

from pyrogram import Client, filters
from pyrogram.types import Message
import asyncio

app = Client("my_account", bot_token="", api_id=0, api_hash="")

@app.on_message(filters.command("hello"))
async def hello(_, message: Message):
    await message.reply_text("Hello!")
    
@app.on_message(filters.text)
async def answer(_, message: Message):
    await asyncio.sleep(60)
    await message.reply_text("Heyy!")
    
app.run()
Dark
  • 25
  • 4

0 Answers0