Delete the element from download_dict if the download failed
Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
parent
a50d0427fd
commit
6fe360ebaa
|
|
@ -38,7 +38,11 @@ BOT_TOKEN = None
|
|||
|
||||
download_dict_lock = threading.Lock()
|
||||
status_reply_dict_lock = threading.Lock()
|
||||
# Key: update.effective_chat.id
|
||||
# Value: telegram.Message
|
||||
status_reply_dict = {}
|
||||
# Key: update.message.message_id
|
||||
# Value: An object of DownloadStatus
|
||||
download_dict = {}
|
||||
# Stores list of users and chats the bot is authorized to use in
|
||||
AUTHORIZED_CHATS = []
|
||||
|
|
|
|||
|
|
@ -52,9 +52,8 @@ class MirrorListener(listeners.MirrorListeners):
|
|||
if len(status_reply_dict) == 1:
|
||||
deleteMessage(self.context, status_reply_dict[self.update.effective_chat.id])
|
||||
del status_reply_dict[self.update.effective_chat.id]
|
||||
if index is not None:
|
||||
with download_dict_lock:
|
||||
del download_dict[self.message.message_id]
|
||||
with download_dict_lock:
|
||||
del download_dict[self.uid]
|
||||
fs_utils.clean_download(progress_status_list[index].path())
|
||||
msg = f"@{self.message.from_user.username} your download has been stopped due to: {error}"
|
||||
sendMessage(msg, self.context, self.update)
|
||||
|
|
|
|||
Loading…
Reference in New Issue