【问题标题】:How to ping the user who initiated a command in discord python?如何ping在discord python中启动命令的用户?
【发布时间】:2020-08-25 06:25:59
【问题描述】:

我正在尝试让我的 discord 机器人 ping 启动命令的用户。 例如,如果用户使用命令“我”,机器人应该只是简单地标记用户自己。

到目前为止,我尝试过的是: await ctx.send(discord.Member.display_name)

只返回 属性对象位置。

提前致谢。

【问题讨论】:

  • 提一下命令的作者可以试试-await ctx.send(f'{ctx.author.mention} is mentioned')

标签: python python-3.x discord discord.py-rewrite


【解决方案1】:

await ctx.send(discord.Member.display_name) 将显示服务器上成员的display_name(又名昵称)。要提及某人,您可以尝试以下操作:

@bot.command()
async def mention(ctx):
    await ctx.send(ctx.author.mention)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-11
    • 1970-01-01
    • 1970-01-01
    • 2017-10-28
    • 2022-01-04
    • 2020-10-13
    • 1970-01-01
    相关资源
    最近更新 更多