mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-03 11:04:51 +00:00
One task per user
This commit is contained in:
parent
c7b0b25c08
commit
1a89ecc7b5
2 changed files with 7 additions and 6 deletions
|
|
@ -45,7 +45,7 @@ async def genss(client, message):
|
||||||
if not DL_TASK.get(message.from_user.id):
|
if not DL_TASK.get(message.from_user.id):
|
||||||
DL_TASK[message.from_user.id] = Lock()
|
DL_TASK[message.from_user.id] = Lock()
|
||||||
|
|
||||||
if DL_TASK[message.from_user.id].locked():
|
if DL_TASK.get(message.from_user.id):
|
||||||
return await process.edit("Sorry to avoid flood and error, bot only process one task at a time.")
|
return await process.edit("Sorry to avoid flood and error, bot only process one task at a time.")
|
||||||
c_time = time.time()
|
c_time = time.time()
|
||||||
the_real_download_location = await replied.download(
|
the_real_download_location = await replied.download(
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,13 @@ async def mediainfo(client, message):
|
||||||
file_info = get_file_id(message.reply_to_message)
|
file_info = get_file_id(message.reply_to_message)
|
||||||
if file_info is None:
|
if file_info is None:
|
||||||
return await process.edit_text("Balas ke format media yang valid")
|
return await process.edit_text("Balas ke format media yang valid")
|
||||||
if not DL_TASK.get(message.from_user.id):
|
async with DL_TASK:
|
||||||
DL_TASK[message.from_user.id] = asyncio.Lock()
|
if not DL_TASK.get(message.from_user.id):
|
||||||
|
DL_TASK[message.from_user.id] = asyncio.Lock()
|
||||||
|
|
||||||
if DL_TASK[message.from_user.id].locked():
|
if DL_TASK.get(message.from_user.id):
|
||||||
return await process.edit("Sorry to avoid flood and error, bot only process one task at a time.")
|
return await process.edit("Sorry to avoid flood and error, bot only process one task at a time.")
|
||||||
|
|
||||||
c_time = time.time()
|
c_time = time.time()
|
||||||
file_path = await message.reply_to_message.download(
|
file_path = await message.reply_to_message.download(
|
||||||
progress=progress_for_pyrogram,
|
progress=progress_for_pyrogram,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue