How do I have two embeds In one? discord.py

Viewed 1422

So I have a help command that sends you a list of commands on your DM's. After it's sent, I want it to send another embed in the same @bot or @client.command so.

import discord
from discord.ext import commands
import etc etc etc

@client.command() async def help(ctx, member: discord.Member=None):

embed=discord.Embed(title='Commands:',colour = discord.Colour.orange())

embed.add_field(name='Bomb', value=f'Deletes Messages in chat\n .bomb 100', inline=False)
embed.add_field(name='Luck', value=f'Like 8ball fourtune teller', inline=False)
embed.add_field(name='Tof', value=f'True or False', inline=False)

embed.add_field(name='Hitme', value=f'See me holy face', inline=False)
embed.add_field(name='Monkey', value=f'Random pic of monkey monkey', inline=False)
embed.add_field(name='Whois', value=f'Userinfo', inline=False)

embed.add_field(name='coin', value=f'Flips a coin', inline=False)
embed.add_field(name='Dice', value=f'Random number from 1 to 6', inline=False)
embed.add_field(name='Randomnumber', value=f'Gives you a random number from 1 to 100', inline=False)

embed.add_field(name='Meme', value=f'Random meme?', inline=False)
embed.add_field(name='Say', value=f'Says what ever you want the bot to say', inline=False)
embed.add_field(name='Kick', value=f'Kicks user (Needs Admin)', inline=False)

embed.add_field(name='Ban', value=f'Bans user (Needs Admin', inline=False)
embed.add_field(name='Unban', value=f'Revokes ban from user. (Needs Admin)', inline=False)
embed.add_field(name='Prefix', value=f'Changes prefix e.g .prefix !', inline=False)

em.set_author(name='***Commands list has been sent!***')
em.set_footer(name='Check Your DM's! ✅')

await ctx.author.send(embed=embed)

await ctx.send(embed=em)

#I want this to work so it would send this embed after it sent the embed on DM's to the channel 
  #where .help was used. this was my attempt I'm new to python

2 Answers

Three things:

  1. em was never defined
  2. em.set_footer has no object name - its text="Check Your DM's! ✅"
  3. ctx.author.send will send the embed to the author of the message -> member.send will send the embed to a certain user

Your code should look like:

@client.command()
async def help(ctx, member:discord.Member = None):
    embed=discord.Embed(title='Commands:',colour = discord.Colour.orange())
    ...

    em = discord.Embed(title="YOU NEED TO SET A TITLE")
    em.set_author(name='***Commands list has been sent!***')
    em.set_footer(text="Check Your DM's! ✅")

    await member.send(embed=embed)

    await ctx.send(embed=em)

Why do you use member:discord.Member = None? You do nothing with it?

If you want to check if a member is given use:

if member is None:
   await ctx.send("Please give me a user °_°")
else:
   YOUR CODE...

The simplest answer to this is to just make 2 embeds.

@client.command()
async def embed(ctx):
    embed=discord.Embed(title="Sample Embed", url="https://realdrewdata.medium.com/", description="This is an embed that will show how to build an embed and the different components", color=discord.Color.blue())
    await ctx.send(embed=embed)
@client.command()
async def embed2(ctx):
    embed=discord.Embed(title="Sample Embed", url="https://realdrewdata.medium.com/", description="This is an embed that will show how to build an embed and the different components", color=discord.Color.blue())
    await ctx.send(embed=embed)

Or, THIS IS UNTESTED, try to put a url on another field:

embed.add_field(name="Field 1 Title", value="This is the value for field 1. This is NOT an inline field.", inline=False, url="foo")

The first one guaranteed works.

Related