Search code examples
pythondiscorddiscord.pyembed

Discord.py embed not getting sent


I was just writing a bot with discord.py but there seems to be a problem in my help command because for some reason the embed which I wish to send is not showing up.

This is my code for the help command:

@client.command(aliases=["h"])
async def bothelp(ctx):
   await ctx.send("help command coming soon!")
   embed = discord.Embed(title = "Help for the bot", description = "", color = discord.Colour.purple())
   embed.add_field(name = "Command List", value = "", inline = False)
   embed.add_field(name = "#hello", value = "Replies with a greeting. \nAliases: hey, hi", inline = True)
   embed.add_field(name = "#whois <mention>", value = "Gives the user info of the member mentioned. \nAliases: user, info", inline = True)
   embed.add_field(name = "#clear (number)", value = "Clears the number of messages given by the user. If number is not entered, deletes the most recent message. \nAliases = c \nPermissions = Manage Messages", inline = True)
   embed.add_field(name = "#kick (mention)", value = "Kicks the member mentioned. \nAliases: k \n Permissions: Kick Members", inline = True)
   embed.add_field(name = "#ban (mention)", value = "Bans the member mentioned. \nAliases: b \n Permissions: Ban Members", inline = True)
   embed.add_field(name = "#unban (username with tag)", value = "Unbans the member specified. \nAliases: ub \n Permissions: Ban Members", inline = True)
   embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}")
   await ctx.send(embed=embed)

However, the embed does not get posted. I tried finding the error but I couldn't. Could someone please help me out?

Thanks!


Solution

  • Field values can not be None or empty string, your 1st field has no value. Add some value to it

    Below is the revised code:

    @client.command(aliases=["h"])
    async def bothelp(ctx):
       await ctx.send("help command coming soon!")
       embed = discord.Embed(title = "Help for the bot", description = "", color = discord.Colour.purple())
       embed.add_field(name = "Command List", value = "Here are all commands", inline = False)
       embed.add_field(name = "#hello", value = "Replies with a greeting. \nAliases: hey, hi", inline = True)
       embed.add_field(name = "#whois <mention>", value = "Gives the user info of the member mentioned. \nAliases: user, info", inline = True)
       embed.add_field(name = "#clear (number)", value = "Clears the number of messages given by the user. If number is not entered, deletes the most recent message. \nAliases = c \nPermissions = Manage Messages", inline = True)
       embed.add_field(name = "#kick (mention)", value = "Kicks the member mentioned. \nAliases: k \n Permissions: Kick Members", inline = True)
       embed.add_field(name = "#ban (mention)", value = "Bans the member mentioned. \nAliases: b \n Permissions: Ban Members", inline = True)
       embed.add_field(name = "#unban (username with tag)", value = "Unbans the member specified. \nAliases: ub \n Permissions: Ban Members", inline = True)
       embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}")
       await ctx.send(embed=embed)