Pycord Guide
  • Old Pycord Guide
  • FAQ
  • Pycord Discord
  • Getting Started
    • Creating a bot
    • Coding your bot
  • Guides
    • Threads
    • Voice Commands
    • Storing Data
    • Basic Features
      • Embeds
  • Interactions
    • Buttons
    • Dropdowns (Select Menus)
    • Context Menu Commands
    • Slash Commands
  • More
    • Installing Git
Powered by GitBook
On this page

Was this helpful?

  1. Guides
  2. Basic Features

Embeds

Making and using embeds with Py-cord

PreviousBasic FeaturesNextButtons

Last updated 3 years ago

Was this helpful?

Embeds can make your bot's messages look a lot cooler. It also has other purposes, like fending off imposers - for example, people used to impersonate Dank Memer and trick users into giving them their items. Seeing this, the developers decided to use embeds - since embeds can only be sent by bots and webhooks, no users could impersonate any longer.

So, its clear that embeds are pretty nice. Adding them is simple enough too!

import discord # make sure you install py-cord - read the Home Page
from discord.ext import commands # will be discussed later
import os

bot = commands.Bot(command_prefix='!', case_insensitive=True)

@bot.event
async def on_ready():
    print(f"{bot.user} is ready and online!")

@bot.command()
async def hello(ctx):
    await ctx.send("Hey!")
    
### Embed Command ###

@bot.command()
async def embed(ctx):
    embed = discord.Embed(title="How to make embeds with Py-cord", description="This tutorial will show you how to make embeds in py-cord. Simple enough, so lets get started!", color = discord.Color.from_rbg(255, 255, 255))
    await ctx.send(embed = embed)

bot.run(os.getenv('TOKEN'))

That simple! Lets now add fields, footers and other cool stuff!

@bot.command()
async def embed(ctx):
    embed = discord.Embed(title="How to make embeds with Py-cord", description="This tutorial will show you how to make embeds in py-cord. Simple enough, so lets get started!", color = discord.Color.from_rbg(255, 255, 255))
    embed.add_field(name="With Inline", value="This is what I would look like with inline", inline=True)
    embed.add_field(name="With Inline", value="This is what I would look like with inline", inline=True)
    embed.add_field(name="With Inline", value="This is what I would look like with inline", inline=True)
    embed.add_field(name="Without Inline", value="This is what I would look like without inline", inline=False)
    embed.add_field(name="Without Inline", value="This is what I would look like without inline", inline=False)
    await ctx.send(embed = embed)
@bot.command()
async def embed(ctx):
    embed = discord.Embed(title="How to make embeds with Py-cord", description="This tutorial will show you how to make embeds in py-cord. Simple enough, so lets get started!", color = discord.Color.from_rbg(255, 255, 255), url="...")
    embed.add_field(name="With Inline", value="This is what I would look like with inline", inline=True)
    embed.add_field(name="With Inline", value="This is what I would look like with inline", inline=True)
    embed.add_field(name="With Inline", value="This is what I would look like with inline", inline=True)
    embed.add_field(name="Without Inline", value="This is what I would look like without inline", inline=False)
    embed.add_field(name="Without Inline", value="This is what I would look like without inline", inline=False)
    
    embed.set_footer(text="...", icon_url="...")
    embed.set_author(name="Pycord Guide", icon_url='...', url="...")
     
    await ctx.send(embed = embed)
    embed.set_footer(..., icon_url=ctx.author.avatar_url)

You may read the docs for more info -

https://pycord.readthedocs.io/en/master/api.html#discord.Embed
This is how embeds look like!
Embeds with fields