0
votes

I want bot to edit sent embed message after 5 seconds:

@client.command(passContent=True)
@commands.has_role("????║Участники")
async def test(ctx):
    loading=client.get_emoji(822491536993550397)
    embed=discord.Embed(description=f'**{loading}Message will be edited in 5 seconds...**', colour=discord.Colour.blue())
    await ctx.send(embed=embed)
    await asyncio.sleep(5)
    done=discord.Embed(title=':white_check_mark:Done!', colour=discord.Colour.green())
    await client.edit(embed, embed=done)

But I am getting this error:

'Bot' object has no attribute 'edit'
1

1 Answers

4
votes

Think of what you are doing here, what exactly is embed. It is simply an object that we send to discord, for editing a message, you need to access the message. not the embed object.

embed=discord.Embed(description=f'**{loading}Message will be edited in 5 seconds...**', colour=discord.Colour.blue())
    message = await ctx.send(embed=embed)
    await asyncio.sleep(5)
    done=discord.Embed(title=':white_check_mark:Done!', colour=discord.Colour.green())
    await message.edit(embed=done)