Discord 'Embed' object has no attribute '_files'

Question:

Tryna send an embed message on the new discord.py 2.0 and isn’t working for me.

@Bot.command()
async def agent(ctx):
    list = ["Neon", "Reyna"]
    await ctx.message.delete()
    emb = discord.Embed(title=f"Agent Picker")
    emb.set_footer(text=f"Used by: {ctx.author.name}")
    emb.add_field(name=f"Agent:", value=f"{random.choice(list)}")
    await ctx.send(embed=emb)

This is the error im getting after running the command, All my embed commands have stopped working and ive got no idea’s to why.

Ignoring exception in command agent: 
Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/core.py", line 173, in wrapped ret = 
await coro(*args, **kwargs)
await ctx.send(embed=emb) 
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/abc.py", line 1564, 
in send if embed._files: AttributeError: 'Embed' object has no attribute '_files'
Asked By: MrToastre

||

Answers:

on the new discord.py 2.0

The error message suggests you’re using disnake, not discord.py 2.0.

File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/abc.py", line 1564, 
#                                                          ^^^^^^^

You’re mixing different versions/forks of the library here, which will lead to bugs like this.

Assuming this isn’t on purpose, uninstall every single discord-related library (disnake, discord-components, etc) and reinstall ONLY discord.py. Installing disnake broke your discord.py installation, so you have to get a clean reinstall without all the other libraries messing with it.

Also, make sure you replace every disnake-related import with a discord.py-one. You can’t pass disnake objects to discord.py & vice-versa.

Answered By: stijndcl
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.