Although this method is valid, I'd recommend switching to saving user IDs instead of usernames + discriminators, as user IDs are constant, but users are able to change their names and discriminators.
@client.command()
async def mention(ctx):
user = discord.utils.get(ctx.guild.members, name="somename", discriminator="1111")
await ctx.send(f"{user.mention} hello!")
And with the ID:
@client.command()
async def mention(ctx):
user = ctx.guild.get_member(112233445566778899) # replace user ID there
try:
await ctx.send(f"{user.mention} hello!")
except:
await ctx.send("Sorry, that user has left the server!")
References:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…