JavaScript
x
10
10
1
@commands.has_permissions(administrator=True)
2
@bot.command()
3
async def ban(ctx, member : discord.Member, *, reason=None):
4
await member.send (f"{member.mention} text {ctx.guild.name} for the reason: {reason} ")
5
await member.ban(reason=reason)
6
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")
7
if reason is None:
8
reason = f"{member.mention} was banned without reasons {ctx.guild.name} "
9
return reason
10
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:
JavaScript
1
17
17
1
@commands.has_permissions(administrator=True)
2
@bot.command()
3
async def ban(ctx, member : discord.Member, *, reason=None):
4
await member.send(f"{member.mention} text {ctx.guild.name} for the reason: {reason} ")
5
await member.ban(reason=reason)
6
7
embed = discord.Embed(color=discord.Color.blue())
8
embed.title = "__Text__" # Title is always bold
9
embed.description = f"{member.mention} n **text:** n *{reason}*"
10
embed.timestamp = datetime.datetime.utcnow() # New timestamp
11
embed.set_footer(text="This is a test", icon_url="PassUrl")
12
await ctx.send (embed=embed) # Send defined embed
13
14
if reason is None:
15
reason = f"{member.mention} was banned without reasons {ctx.guild.name} "
16
return await ctx.send(f"{reason}")
17
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.