diff --git a/misskaty/plugins/genss.py b/misskaty/plugins/genss.py index 94c06372..61584cae 100644 --- a/misskaty/plugins/genss.py +++ b/misskaty/plugins/genss.py @@ -41,11 +41,12 @@ async def genss(client, message): if media is None: return await message.reply("Reply to a Telegram Video or document as video to generate screenshoot!") process = await message.reply_text("`Processing, please wait..`") - if not DL_TASK.get(message.from_user.id): - DL_TASK[message.from_user.id] = Lock() + async with Lock(): + if not DL_TASK.get(message.from_user.id): + DL_TASK[message.from_user.id] = Lock() - if DL_TASK[message.from_user.id].locked(): - return await process.edit("Sorry to avoid flood and error, bot only process one task at a time.") + if DL_TASK[message.from_user.id].locked(): + return await process.edit("Sorry to avoid flood and error, bot only process one task at a time.") c_time = time.time() the_real_download_location = await replied.download( progress=progress_for_pyrogram,