如何获得用户名Python

问题描述 投票:-4回答:1

如何获取catch标记的用户名作为回复。当我们标记它们的示例?hello @Steve时,下面的代码将Dm发送给用户

@bot.command(pass_context=True)
async def hello(ctx, member: discord.Member):
    await bot.send_message(member, "Hi (username) how are you.")

机器人回复的Hi Steve how are you.

python python-3.x discord discord.py
1个回答
0
投票

检查User示例:

await bot.send_message(member, "Hi {} I love ya.".format(member.name)) 
© www.soinside.com 2019 - 2024. All rights reserved.