Reputation: 31
Right, I want to make it so when I do "/ban @user reason" the bot responds with an embed saying are you sure you want to ban this user and reacts to its message with a tick, and awaits for the reaction off of the person who made the ban.
Upvotes: 3
Views: 44
Reputation: 4680
Try this:
@bot.command(name="ban")
async def ban(ctx, member, reason=""):
if not ctx.message.mentions:
await ctx.channel.send("You must mention a user to use this command")
embed = discord.Embed(
title="Confirm ban",
description=f"Are you sure you want to ban {member.mention}",
color=0xff0000
)
message = await ctx.channel.send(embed=embed)
await message.add_reaction(u"\U0001F44D")
def check(pay):
pay.member == member and pay.message_id == ctx.message.id
await bot.wait_for("raw_reaction_add", check=check)
await member.ban(reason=reason)
Upvotes: 2