1#discord.py rewrite
2#python 3+
3bot.command(name='pingme', help='pings the author of the message')
4async def pingme(ctx):
5 #to get a member from a 'ctx' object is ctx.author
6 #from there its .mention will mention (ping) the user
7 #also there are others like .id
8 await ctx.send(ctx.author.mention)
1myid = '<@201909896357216256>'
2await client.send_message(message.channel, ' : %s is the best ' % myid)
1import discord
2import os
3
4TOKEN = os.environ["<token code here>"]
5client = discord.Client()
6
7#This command basicallty mentions the person who used the command.
8if message.content.startswith("!mentionself"):
9 ID = message.author.id
10 await message.channel.send("<@"+str(id)+"> Mentioned you!")
11
12#-OR-
13#(This one is just more efficient.)
14
15if message.content.startswith("!mentionself"):
16 author = message.author
17 await message.channel.send({author.mention}+" - Mentioned you!")
18
19client.run(TOKEN)