'Why does my kick command not work? discord.py
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member : discord.Member, *, reason=None):
embed = discord.Embed(title="Kicked", description=f"You have been Kicked from {member.guild.name}.")
embed.add_field(name="Reason:", value=reason)
embed.add_field(name="Moderator:", value=f"{ctx.message.author.name}#{ctx.message.author.discriminator}")
await member.send(embed=embed)
await member.kick(reason=reason)
success = discord.Embed(title="Successfully Kicked", description=f"You Kicked {member.name}#{member.discriminator}")
success.add_field(name="Reason:", value=reason)
await ctx.reply(embed=success)
this is the same for ban, it worked before i added the embeds
Solution 1:[1]
Try using await ctx.send() instead like so:
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member : discord.Member, *, reason=None):
embed = discord.Embed(title="Kicked", description=f"You have been Kicked from {member.guild.name}.")
embed.add_field(name="Reason:", value=reason)
embed.add_field(name="Moderator:", value=f"{ctx.message.author.name}#{ctx.message.author.discriminator}")
await member.send(embed=embed)
await member.kick(reason=reason)
success = discord.Embed(title="Successfully Kicked", description=f"You Kicked {member.name}#{member.discriminator}")
success.add_field(name="Reason:", value=reason)
await ctx.send(embed=success)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mr bean |
