I am coding a discord bot and for one of the commands I want the bot to ping the user that sent the command. I'm using python 3.6.6
I am coding a discord bot and for one of the commands I want the bot to ping the user that sent the command. I'm using python 3.6.6
Here is one example how you can ping (mention) the user who sent a specific message (command):
import discordclass MyClient(discord.Client):async def on_ready(self):print('Logged on as', self.user)async def on_message(self, message):# don't respond to ourselvesif message.author == self.user:returnif message.content == '$the_ping_cmd':await message.channel.send('Pinging {}'.format(message.author.mention))client = MyClient()
client.run('token')