discord.py mention user in message code example
Example 1: discord.py mention user
#discord.py rewrite
#python 3+
bot.command(name='pingme', help='pings the author of the message')
async def pingme(ctx):
#to get a member from a 'ctx' object is ctx.author
#from there its .mention will mention (ping) the user
#also there are others like .id
await ctx.send(ctx.author.mention)
Example 2: discord.py message user
if message.content == "dm":
await message.channel.send("Dming user")
dm = await message.author.create_dm() # Creates a dm channel with the user
await dm.send("What you want to send") # Sends the user the message
Example 3: how to mention someone discord.py
myid = '<@201909896357216256>'
await client.send_message(message.channel, ' : %s is the best ' % myid)