【问题标题】:How to get tag of user in discord.py?如何在 discord.py 中获取用户标签?
【发布时间】:2020-06-26 13:46:45
【问题描述】:

如果我有用户对象,我将如何获取用户的标签?例如,如果我想打印类似CircuitSacul#1111 的内容,我会使用类似的内容

print(f"{owner.name}:#{owner.tag}")

但是,我收到“用户对象没有属性'标签'”的错误。

【问题讨论】:

  • 请注意,打印User/Member 对象将获得相同的结果。
  • @InsertCheesyLine 是的,谢谢

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


【解决方案1】:

这是user's discriminator

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-19
    • 2019-04-02
    • 2021-07-12
    • 2016-10-19
    • 2021-05-08
    • 1970-01-01
    • 2021-05-07
    • 2021-08-02
    相关资源
    最近更新 更多