Home > Net >  Discord.py Embed not sending
Discord.py Embed not sending

Time:12-31

I have this Cog, but it's not sending the embed, I even tried with embeds, but its only sending the first text and I'm not sure why.

from discord.ext import commands 

class HelpCommand(commands.Cog):
def __init__(self, client):
    self.client = client

@commands.Cog.listener()
async def on_ready(self):
    print("Test Ready")

@commands.command(aliases=["h"])
async def command(self, ctx):
    await ctx.send(f'Please wait')
    embed = discord.Embed(title="Help for the bot",
                          description="", color=discord.Colour.purple())
    embed.set_footer(icon_url=ctx.author.avatar_url,
                     text=f"Requested by {ctx.author.name}")
    await ctx.send(embed=embed)
async def setup(client):
    await client.add_cog(HelpCommand(client))

CodePudding user response:

You should be getting an error for this so you probably didn't configure logging properly, but avatar_url was removed in 2.0.

Migration guide: https://discordpy.readthedocs.io/en/stable/migrating.html#asset-redesign-and-changes

Member.avatar_url (replaced by Member.avatar)

  • this new attribute may now be None

This now returns an Asset, and if you look at the docs for that you'll see that it has a url attribute. Note that you won't be able to access it if the avatar is None, so you'll have to check that first.

  • Related