Skip to content
Advertisement

the embed do not send and i didint have errors

@commands.has_permissions(administrator=True)
@bot.command()
async def ban(ctx, member : discord.Member, *, reason=None):
    await member.send (f"{member.mention} text  {ctx.guild.name}  for the reason: {reason} ")
    await  member.ban(reason=reason)
    await ctx.send (title=f"**__text:__**", description=f"{member.mention} n  **text:** n *{reason}*", timestamp=datetime.datetime.utcnow(),color=discord.Color.blue()) .embed.set_footer (text="text ", icon_url="url")
    if reason is None:
        reason = f"{member.mention} was banned without reasons {ctx.guild.name} "
        return reason

i dont have errors and the embed didint send

Advertisement

Answer

I would recommend you a better division to minimize the sources of errors. The best way is to define an embed.

Have a look at the following code:

@commands.has_permissions(administrator=True)
@bot.command()
async def ban(ctx, member : discord.Member, *, reason=None):
    await member.send(f"{member.mention} text  {ctx.guild.name}  for the reason: {reason} ")
    await member.ban(reason=reason)

    embed = discord.Embed(color=discord.Color.blue())
    embed.title = "__Text__" # Title is always bold
    embed.description = f"{member.mention} n  **text:** n *{reason}*"
    embed.timestamp = datetime.datetime.utcnow() # New timestamp
    embed.set_footer(text="This is a test", icon_url="PassUrl")
    await ctx.send (embed=embed) # Send defined embed

    if reason is None:
        reason = f"{member.mention} was banned without reasons {ctx.guild.name} "
        return await ctx.send(f"{reason}")

Also pay attention to proper indentation, possibly too many spaces, etc.

Maybe also have a look at the docs and how to create a valid embed.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement