Lazo Lab Sign up

App 8: Build a Discord Bot / Build a Discord bot

Lesson 7 of 10

Embeds

Embeds are nicely formatted cards with titles, colours and fields. They make your bot look professional.

Key points

  • discord.Embed(title=..., color=...)
  • embed.add_field(name, value)
  • send_message(embed=embed)
@tree.command(name="profile", description="Show a profile card")
async def profile(interaction: discord.Interaction):
    e = discord.Embed(title=interaction.user.display_name, color=0xF5D90A)
    e.add_field(name="Joined", value=interaction.user.joined_at.strftime("%Y-%m-%d"))
    await interaction.response.send_message(embed=e)

Your turn

Make /profile show an embed with at least two fields.

Watch a video on thisOpens YouTube search results for “Embeds” in a new tab

Quiz · +10 XP

What is an embed?

Log in to save progress and earn XP.