Aria2p Attribute Error while canceling download using gid

34 Views Asked by At

I'm trying to cancel the current downloading file using by it gid, but am getting the below error

Aria2C Error : 'str' object has no attribute 'is_complete'

async def cancel_download(id):
    try:
        await aria2.remove(id)
        return True
    except Exception as e:
        logger.error(f"Error cancelling download with GID {id}: {e}")
        return False
async def cancel_command(bot, message):
    try:
        id = message.text.replace("/cancel ", "")
        result = await cancel_download(id)
        if result:
            await message.reply_text(f"Download with id {id} cancelled successfully.")
        else:
            await message.reply_text(f"Error cancelling download with id {id}.")
    except ValueError:
        await message.reply_text("Invalid cancel command format.")
0

There are 0 best solutions below