#this is what you want!
@bot.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, user: discord.Member, *, reason=None):
if reason == None:
reason = f"{user} banned by {ctx.author}"
if ctx.author.top_role < user.top_role:
return await ctx.send("**You don't have enough permission**')
if ctx.author.top_role > user.top_role:
return await ctx.guild.ban(user, reason=reason)
return await ctx.send(f"{user} Successfully Banned by {ctx.author.mention}")