discord.py mention code example
Example 1: discord.py ban
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, user: discord.Member, *, reason):
await ctx.guild.ban(user, reason=reason)
await user.send(f"You have been banned in {ctx.guild} for {reason}")
await ctx.send(f"{user} has been successfully banned.")
Example 2: discord.py mention user
bot.command(name='pingme', help='pings the author of the message')
async def pingme(ctx):
await ctx.send(ctx.author.mention)
Example 3: how to mention someone discord.py
myid = '<@201909896357216256>'
await client.send_message(message.channel, ' : %s is the best ' % myid)
Example 4: python discord mention user
await message.channel.send(message.author.mention)