for example:
me: -mention LOL
Bot: @LOL
You can use member: discord.Member
as an required argument.
If you want to mention a user you have to use member.mention
.
Here is an example code:
@client.command() # Or whatever you use
async def mention(ctx, member: discord.Member = None):
if member == None: # If no argument was passed
await ctx.send(ctx.author.mention) # Mention the author of the command
else:
await ctx.send(member.mention) # Mention the member
Here is how it looks like:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.