简体   繁体   中英

Discord.py Embed not sending

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))

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM