I'm trying to make the command also mention the person who wrote the command, how do I add it to the current command:
import discord from discord.ext import commands token = "" #bot token here client = commands.Bot(command_prefix= "!") @client.command() async def ping(ctx): await ctx.send('pong')
I have tried to add this code:
@client.command() async def command(ctx): author = ctx.message.author
.. but it hasn't worked for me while making it print the author as well.
If you are just looking to add it to a command, ctx.author.mention should do the job
@client.command() async def ping(ctx): await ctx.send(f'pong {ctx.author.mention}')
2.1m questions
2.1m answers
60 comments
57.0k users