Exemple #1
0
def cancel_all(update, context):
    count = 0
    gid = 0
    while True:
        dl = getAllDownload()
        if dl:
            if dl.gid() != gid:
                gid = dl.gid()
                dl.download().cancel_download()
                count += 1
                sleep(0.3)
        else:
            break
    sendMessage(f'{count} Download(s) has been Cancelled!', context.bot, update)
Exemple #2
0
def cancel_all(update, context):
    count = 0
    gid = 1
    while True:
        dl = getAllDownload()
        if dl:
            if dl.gid() == gid:
                continue
            else:
                gid = dl.gid()
                dl.download().cancel_download()
                sleep(0.5)
                count += 1
        else:
            break
    delete_all_messages()
    sendMessage(f'{count} Download(s) has been Cancelled!', context.bot,
                update)