From 7020b810a2e54fa686e1611dd030a1b3310f08a8 Mon Sep 17 00:00:00 2001 From: anasty17 Date: Mon, 22 Jan 2024 01:27:20 +0200 Subject: [PATCH] minor change Signed-off-by: anasty17 --- bot/modules/force_start.py | 42 +++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/bot/modules/force_start.py b/bot/modules/force_start.py index d132cd65e0b..ad4b2ed69b9 100644 --- a/bot/modules/force_start.py +++ b/bot/modules/force_start.py @@ -50,33 +50,29 @@ async def remove_from_queue(_, message): return obj = task.task() listener = obj.listener - if status == "fu": - listener.forceUpload = True - if listener.mid in queued_up: - async with queue_dict_lock: + msg = "" + async with queue_dict_lock: + if status == "fu": + listener.forceUpload = True + if listener.mid in queued_up: await start_up_from_queued(listener.mid) - await sendMessage(message, "Task have been force started!") - elif status == "fd": - listener.forceDownload = True - if listener.mid in queued_dl: - async with queue_dict_lock: + msg = "Task have been force started to upload!" + elif status == "fd": + listener.forceDownload = True + if listener.mid in queued_dl: await start_dl_from_queued(listener.mid) - await sendMessage(message, "Task have been force started to download only!") - else: - listener.forceDownload = True - listener.forceUpload = True - if listener.mid in queued_up: - async with queue_dict_lock: + msg = "Task have been force started to download only!" + else: + listener.forceDownload = True + listener.forceUpload = True + if listener.mid in queued_up: await start_up_from_queued(listener.mid) - await sendMessage(message, "Task have been force started to upload!") - elif listener.mid in queued_dl: - async with queue_dict_lock: + msg = "Task have been force started to upload!" + elif listener.mid in queued_dl: await start_dl_from_queued(listener.mid) - await sendMessage( - message, - "Task have been force started to download and upload will start once download finish!", - ) - + msg = "Task have been force started to download and upload will start once download finish!" + if msg: + await sendMessage(message, msg) bot.add_handler(